-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/raluca/Dropbox/Replication/BJPS/analysis_log.log
  log type:  text
 opened on:  11 Dec 2023, 12:39:55

. 
. /*********************************************************
> Title: Mind the Gap: Why Wealthy Voters Support Brexit
> Authors: Jane Green and Raluca L Pahontu
> **********************************************************/
. 
. /*********************************************************
> 
>                                                 Table_of_contents
>                                                 
> * 1. Set Directory
> * 2. Data Cleaning
> * 3. Data Descriptives
> * 4. Data Preparation
> * 5. Data Analysis
> **********************************************************/
. 
. clear all

. set maxvar 10000


. set scheme plotplainblind

. set more off

. 
. ************************************************************************
. *                                                       1. Set Directory
. ************************************************************************
. 
. global main "~/Dropbox/Replication/BJPS/"

. global code "~/Dropbox/Replication/BJPS/code"

. global input "~/Dropbox/Replication/BJPS/input"

. global temp "~/Dropbox/Replication/BJPS/temp"

. global output "~/Dropbox/Replication/BJPS/figures"

. 
. cd "$main"
/Users/raluca/Dropbox/Replication/BJPS

. 
. cd "~/Dropbox/Replication/BJPS/"
/Users/raluca/Dropbox/Replication/BJPS

. 
. ************************************************************************
. *                                                       2. Data Cleaning
. ************************************************************************
. 
. do "$code/2-dataclean"

. program define besw14b
  1. use "$input/bes-subset", clear
  2. 
. replace euRefVoteW14 = . if euRefVoteW14 ==  9999
  3. 
. gen leave = 1 if euRefVoteW14 == 1
  4. replace leave = 0 if euRefVoteW14 == 0
  5. 
. replace  anyUniW14  = . if  anyUniW14  == 9999
  6. 
. gen wkstat = 1 if workingStatusW14 == 1 |  workingStatusW14 == 2 | workingStatusW14 ==3 // employed
  7. replace wkstat = 2 if workingStatusW14 == 4 // unemployed
  8. replace wkstat = 3 if workingStatusW14 == 5 | workingStatusW14 == 6  // student
  9. replace wkstat = 4 if workingStatusW14 == 7 // retired 
 10. replace wkstat = 5 if workingStatusW14 == 8 // not in paid work for any other reason
 11. 
. gen married = 0 if profile_marital_statW14 !=.
 12. replace married = 1 if profile_marital_statW14 == 1 | profile_marital_statW14 == 2
 13. 
. gen female = 1 if gender == 2
 14. replace female = 0 if gender == 1
 15. 
. destring supergroup_code , replace
 16. rename supergroup_code onsAreaSupergroupW14
 17. end

. 
. program define boe
  1. use "$input/nmg", clear
  2. 
. gen leave = 4 if brexit == "Very positive about the result"  | brexit == "very positive about the result" 
  3. replace leave = 3 if brexit == "Somewhat positive"  | brexit == "somewhat positive"
  4. replace leave = 2 if brexit == "Somewhat negative"  | brexit == "somewhat negative"
  5. replace leave = 1 if brexit == "Very negative"  | brexit == "very negative"
  6. 
. gen leave_bin = 1 if leave == 4 | leave == 3
  7. replace leave_bin = 0 if leave == 2 | leave == 1
  8. 
. 
. gen female = 1 if sex == "female"
  9. replace female = 0 if sex == "male"
 10. 
. rename educ education
 11. gen educ = 0 if education == "GSCE/O-Level/CSE" |  education == "No formal qualification" |  education == " vocational qualification" | education == " Other"   // never attended higher education 
 12. replace educ = 1 if education == "A-Level or equivalent"  // high school
 13. replace educ = 2 if education == "Bachelor Degree or equivalent" | education == "Masters, PhD or equivalent" // higher education
 14. 
. gen wkstat = 1 if workingstatus2014 == "Have pai" | workingstatus2015 =="Self-emp" | workingstatus2015 == "Have paid jo" | workingstatus2015 == "Self-employe" | ///
> workingstatus2016 == "Have paid job - full time (30+ hours .." | workingstatus2016 == "Have paid job - part time (up to 29 h.." | workingstatus2016 == "Self-employed" | ///
> workingstatus2017 == "Have paid job - full time (30+ hours .." | workingstatus2017 == "Have paid job - part time (up to 29 h.." | workingstatus2017 == "Self-employed" | ///
> workingstatus2018 == 1 |  workingstatus2018 == 2 | workingstatus2018 == 3 // employed 
 15. replace wkstat = 2 if workingstatus2014 == "Unemploy" | workingstatus2015 =="Unemployed a" | workingstatus2016 == "Unemployed and seeking work" |  workingstatus2017 == "Unemployed and seeking work" | workingstatus2018 
> == 5 // unemployed
 16. replace wkstat = 3 if workingstatus2014 ==  "Full tim" | workingstatus2015 =="Full time st" |  workingstatus2016 == "Full time student/still at school" |   workingstatus2017 == "Full time student/still at school" | wor
> kingstatus2018 == 4 // student
 17. replace wkstat = 4 if workingstatus2014 == "Retired" | workingstatus2015 == "Retired" |  workingstatus2016 == "Retired" | workingstatus2017 == "Retired" | workingstatus2018 == 6 // retired 
 18. replace wkstat = 5 if workingstatus2014 == "Not in p" | workingstatus2015 == "Not in paid" | workingstatus2016 == "Not in paid work because of long term.." | ///
> workingstatus2016 == "Not in paid work for other reason" | workingstatus2017 == "Not in paid work because of long term.." | ///
> workingstatus2017 == "Not in paid work for other reason" | workingstatus2018 == 7 | workingstatus2018 == 8 // not in paid work for any other reason
 19. 
. 
. replace fihhyr2_m = "." if fihhyr2_m == "don't know" // household income
 20. replace fihhyr2_m = "." if fihhyr2_m == "refused" // household income
 21. destring fihhyr2_m, replace
 22. 
. 
. encode region, gen(regionid)
 23. end

. 
end of do-file

. besw14b
(Written by R.              )
(994 real changes made, 994 to missing)
(10,464 missing values generated)
(8,865 real changes made)
(405 real changes made, 405 to missing)
(10,096 missing values generated)
(291 real changes made)
(286 real changes made)
(7,261 real changes made)
(1,867 real changes made)
(12,682 real changes made)
(9,099 missing values generated)
(9,099 real changes made)
supergroup_code: all characters numeric; replaced as byte

. 
. 
. global cfe gender ageW14 i.anyUniW14 al_scaleW14 i.married i.wkstat i.onsAreaSupergroupW14

. 
. boe
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. global cfep i.regionid i.year

. global cfef  c.age##c.age i.educ i.wkstat i.regionid i.year

. 
. 
. ************************************************************************
. *                                                       3. Data Descriptives
. ************************************************************************
. 
. 
. *************
. * Table A1
. *************
. preserve

. besw14b
(Written by R.              )
(994 real changes made, 994 to missing)
(10,464 missing values generated)
(8,865 real changes made)
(405 real changes made, 405 to missing)
(10,096 missing values generated)
(291 real changes made)
(286 real changes made)
(7,261 real changes made)
(1,867 real changes made)
(12,682 real changes made)
(9,099 missing values generated)
(9,099 real changes made)
supergroup_code: all characters numeric; replaced as byte

. svyset [pw=wt_new_W14] 

      pweight: wt_new_W14
          VCE: linearized
  Single unit: missing
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: <zero>

. 
. gen homevalue = 0 if homeOwnW14 == 3 | homeOwnW14 == 4 | homeOwnW14 == 5 // no asset is renting
(15,031 missing values generated)

. replace homevalue = 24999.5 if homeAmtbW14 ==  1
(142 real changes made)

. replace homevalue = 74999.5 if homeAmtbW14 ==  2
(811 real changes made)

. replace homevalue = 124999.5 if homeAmtbW14 ==  3
(1,897 real changes made)

. replace homevalue = 174999.5 if homeAmtbW14 ==  4
(2,063 real changes made)

. replace homevalue = 224999.5 if homeAmtbW14 ==  5
(1,662 real changes made)

. replace homevalue = 274999.5 if homeAmtbW14 ==  6
(1,440 real changes made)

. replace homevalue = 349999.5 if homeAmtbW14 ==  7
(1,784 real changes made)

. replace homevalue = 449999.5 if homeAmtbW14 ==   8
(974 real changes made)

. replace homevalue = 549999.5 if homeAmtbW14 ==  9
(520 real changes made)

. replace homevalue = 649999.5 if homeAmtbW14 == 10
(269 real changes made)

. replace homevalue = 749999.5 if homeAmtbW14 == 11
(184 real changes made)

. replace homevalue = 849999.5 if homeAmtbW14 == 12
(128 real changes made)

. replace homevalue = 949999.5 if homeAmtbW14 == 13
(78 real changes made)

. 
. svy: tab wkstat
(running tabulate on estimation sample)

Number of strata   =         1                  Number of obs     =     19,148
Number of PSUs     =    19,148                  Population size   = 16,601.243
                                                Design df         =     19,147

----------------------
   wkstat | proportion
----------+-----------
        1 |      .5567
        2 |      .0187
        3 |      .0243
        4 |      .3029
        5 |      .0974
          | 
    Total |          1
----------------------
  Key:  proportion  =  cell proportion

. svy: tab homeOwnW14
(running tabulate on estimation sample)

Number of strata   =         1                  Number of obs     =     19,539
Number of PSUs     =    19,539                  Population size   = 16,973.936
                                                Design df         =     19,538

----------------------
Which of  |
these     |
applies   |
to your   |
home?     | proportion
----------+-----------
 Owned ou |      .4137
 Own with |      .2986
 Rented f |      .0668
 Rented f |      .1288
 It belon |      .0618
 Don't kn |      .0302
          | 
    Total |          1
----------------------
  Key:  proportion  =  cell proportion

. svy: mean homevalue if homevalue>0
(running mean on estimation sample)

Survey: Mean estimation

Number of strata =       1        Number of obs   =     11,952
Number of PSUs   =  11,952        Population size =  9,788.944
                                  Design df       =     11,951

--------------------------------------------------------------
             |             Linearized
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
   homevalue |   270616.3   1772.809      267141.3    274091.3
--------------------------------------------------------------

. drop homevalue

. restore

. 
. *************
. * Figure A1
. *************
. 
. preserve 

. besw14b
(Written by R.              )
(994 real changes made, 994 to missing)
(10,464 missing values generated)
(8,865 real changes made)
(405 real changes made, 405 to missing)
(10,096 missing values generated)
(291 real changes made)
(286 real changes made)
(7,261 real changes made)
(1,867 real changes made)
(12,682 real changes made)
(9,099 missing values generated)
(9,099 real changes made)
supergroup_code: all characters numeric; replaced as byte

. svyset [pw=wt_new_W14] 

      pweight: wt_new_W14
          VCE: linearized
  Single unit: missing
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: <zero>

. 
. *Income
. qui svy: tab profile_gross_householdW14

. gen incomereport = 1 if profile_gross_householdW14 >=1 & profile_gross_householdW14<16
(4,918 missing values generated)

. replace incomereport = 0 if profile_gross_householdW14==17 | profile_gross_householdW14 == 9999 
(4,918 real changes made)

. 
. *Debt
. qui svy: tab debtW14

. gen debtreport = 1 if debtW14 == 0 | debtW14 == 1
(1,234 missing values generated)

. replace debtreport = 0 if debtW14 == 9999 
(1,234 real changes made)

. 
. qui svy: tab debtAmtbW14 

. gen debtamtreport = 1 if debtAmtbW14 >=1 & debtAmtbW14<=17
(15,641 missing values generated)

. replace debtamtreport = 0 if debtAmtbW14 ==9999 
(1,015 real changes made)

. 
. *Savings
. qui svy: tab savingsW14

. gen savereport = 1 if savingsW14 == 0 | savingsW14 == 1 
(1,823 missing values generated)

. replace savereport = 0 if savingsW14 == 9999
(1,823 real changes made)

.  
. qui svy: tab savingsAmtbW14

. gen saveamtreport = 1 if savingsAmtbW14 >=1 &  savingsAmtbW14 <= 17
(10,947 missing values generated)

. replace saveamtreport = 0 if savingsAmtbW14 == 9999
(4,364 real changes made)

.  
. * Rent
. qui svy: tab rentPaymentW14

. gen rentreport = 1 if rentPaymentW14 >=0 & rentPaymentW14<= 100 
(16,750 missing values generated)

. replace rentreport = 0 if rentPaymentW14 == 9999
(1,719 real changes made)

. 
. *Mortgage
. qui svy: tab mortgagePaymentW14

. gen mortgagereport = 1 if mortgagePaymentW14 >=0 & mortgagePaymentW14 <= 100
(15,855 missing values generated)

. replace mortgagereport = 0 if mortgagePaymentW14 == 9999
(1,670 real changes made)

. 
. *Home Value
. qui svy: tab homeOwnW14

. gen homeownreport = 1 if homeOwnW14 >= 1 & homeOwnW14 <=5
(378 missing values generated)

. replace homeownreport = 0 if homeOwnW14 == 9999
(378 real changes made)

. 
. qui svy: tab homeAmtb

. gen homeamtreport = 1 if homeAmtb >= 1 & homeAmtb <=14
(7,444 missing values generated)

. replace homeamtreport = 0 if homeAmtb == 9999 
(2,558 real changes made)

. 
. qui reg  incomereport leave $cfe, r 

. estimates store l11             

. qui reg  debtreport leave $cfe, r

. estimates store l21

. qui reg  debtamtreport leave $cfe, r

. estimates store l31

. qui reg  savereport leave $cfe, r

. estimates store l41

. qui reg  saveamtreport leave $cfe, r

. estimates store l51

. qui reg  rentreport leave $cfe, r

. estimates store l61

. qui reg  mortgagereport leave $cfe, r

. estimates store l71

. qui reg  homeownreport leave $cfe, r

. estimates store l81

. qui reg  homeamtreport leave $cfe, r

. estimates store l91

. 
. coefplot l11 l21 l31 l41 l51 l61 l71 l81 l91 /// //l101 l111 
> , keep (leave) xline(0, lcolor(red) lstyle(solid)) msymbol(circle)   legend(off)  aseq swapnames xlabel(-.15 -.1 -.05 0 .05 .1 .15)  ///
>     coeflabels(l11 = "Income Reporting" ///
>                            l21 = "Debt Reporting"  ///
>                l31 = "Debt Amount Reporting" /// 
>                            l41 = "Savings  Reporting" /// 
>                l51 = "Savings Amount  Reporting" /// 
>                l61 = "Rent Amount  Reporting" /// 
>                l71 = "Mortgage Amount  Reporting" /// 
>                l81 = "Home Ownership  Reporting" /// 
>                l91 = "Home Amount  Reporting" ) mfcolor(white) mlcolor (black) msize(1.5) ciopts(lpatt(solid)lcol(black)) 

.                           
. graph export "$output/fig_a1bes.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_a1bes.pdf written in PDF format)

. restore

. 
. 
. preserve

. boe
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. svyset [pw=weight] 

      pweight: weight
          VCE: linearized
  Single unit: missing
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: <zero>

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. 
. svy: tab tenure
(running tabulate on estimation sample)

Number of strata   =         1                  Number of obs     =     24,036
Number of PSUs     =    24,036                  Population size   =     24,036
                                                Design df         =     24,035

----------------------
   tenure | proportion
----------+-----------
  Housing |      .0579
 Local au |      .1142
 Other/Do |          0
 Owned mo |      .2965
 Owned ou |      .3352
  Private |      .1963
          | 
    Total |          1
----------------------
  Key:  proportion  =  cell proportion

  Table contains a zero in the marginals.
  Statistics cannot be computed.

. svy: tab wkstat
(running tabulate on estimation sample)

Number of strata   =         1                  Number of obs     =     22,841
Number of PSUs     =    22,841                  Population size   = 22,577.885
                                                Design df         =     22,840

----------------------
   wkstat | proportion
----------+-----------
        1 |      .4908
        2 |      .0377
        3 |       .047
        4 |      .3276
        5 |      .0969
          | 
    Total |          1
----------------------
  Key:  proportion  =  cell proportion

. svy: mean homevalue if homevalue >0
(running mean on estimation sample)

Survey: Mean estimation

Number of strata =       1        Number of obs   =     14,895
Number of PSUs   =  14,895        Population size = 13,332.637
                                  Design df       =     14,894

--------------------------------------------------------------
             |             Linearized
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
   homevalue |   263643.1   1644.834      260419.1    266867.2
--------------------------------------------------------------

. restore

. 
. preserve 

. boe
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. gen incomereport = 1 if fihhyr2_m !=. 
(3,768 missing values generated)

. replace incomereport = 0 if fihhyr2_m == .
(3,768 real changes made)

. 
. replace nvesttot_m = "." if nvesttot_m == "refused"
(1,190 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "NA"
(44 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "Not applicable"
(1,010 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "not applicable"
(3,344 real changes made)

. 
. destring nvesttot_m, replace 
nvesttot_m: all characters numeric; replaced as long
(5588 missing values generated)

. rename nvesttot_m totalsaving

. 
. gen savereport = 1 if totalsaving !=. 
(5,588 missing values generated)

. replace savereport = 0 if totalsaving == .
(5,588 real changes made)

. 
. 
. replace ustot_m = "." if ustot_m == "don't know"
(862 real changes made)

. replace ustot_m = "." if ustot_m == "refused"
(550 real changes made)

. replace ustot_m = "." if ustot_m == "NA"
(294 real changes made)

. replace ustot_m = "." if ustot_m == "Don't know"
(189 real changes made)

. replace ustot_m = "." if ustot_m == "Not applicable"
(2,934 real changes made)

. replace ustot_m = "." if ustot_m == "not applicable"
(5,883 real changes made)

. replace ustot_m = "." if ustot_m == "Refused"
(129 real changes made)

. destring ustot_m, replace
ustot_m: all characters numeric; replaced as long
(10841 missing values generated)

. rename ustot_m debtamount

. gen totaldebt = debtamount
(10,841 missing values generated)

. replace totaldebt = 0 if us == "0" | us == "No"
(7,962 real changes made)

. 
. gen debtreport = 1 if totaldebt !=. 
(2,879 missing values generated)

. replace debtreport = 0 if totaldebt == .
(2,879 real changes made)

. 
. replace mrent = "." if mrent == "Don't know"
(275 real changes made)

. replace mrent = "." if mrent == "NA"
(12,188 real changes made)

. replace mrent = "." if mrent == "Prefer not to state"
(356 real changes made)

. destring mrent, replace
mrent: all characters numeric; replaced as long
(24827 missing values generated)

. gen rent_y = 12 * mrent
(24,827 missing values generated)

. 
. gen owner = 1 if tenure == "Owned mortgage" | tenure == "Owned outright"
(14,096 missing values generated)

. replace owner = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace rent_y = 0 if owner == 1 
(15,941 real changes made)

. 
. gen rentreport = 1 if rent_y !=. 
(8,886 missing values generated)

. replace rentreport = 0 if rent_y == .
(8,886 real changes made)

. 
. replace xpmg_m = "." if xpmg_m == "don't know"
(357 real changes made)

. replace xpmg_m = "." if xpmg_m == "refused"
(406 real changes made)

. replace xpmg_m = "." if xpmg_m == "NA"
(0 real changes made)

. replace xpmg_m = "." if xpmg_m == "Don't know"
(56 real changes made)

. replace xpmg_m = "." if xpmg_m == "Not applicable"
(4,181 real changes made)

. replace xpmg_m = "." if xpmg_m == "not applicable"
(16,348 real changes made)

. replace xpmg_m = "." if xpmg_m == "Refused"
(112 real changes made)

. destring xpmg_m, replace
xpmg_m: all characters numeric; replaced as int
(21460 missing values generated)

. rename xpmg_m mortgage_m

. gen mortgage_y = 12 * mortgage_m 
(21,460 missing values generated)

. 
. replace mortgage_y = 0 if tenure == "Owned outright" | tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented" 
(16,573 real changes made)

. 
. gen mortgagereport = 1 if mortgage_y !=. 
(4,887 missing values generated)

. replace mortgagereport = 0 if mortgage_y == .
(4,887 real changes made)

. 
. gen homereport = 1 if owner !=. 
(6,202 missing values generated)

. replace homereport = 0 if owner == .
(6,202 real changes made)

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. replace homevalue = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. gen homeAMTreport = 1 if homevalue !=. 
(7,510 missing values generated)

. replace homeAMTreport = 0 if homevalue == .
(7,510 real changes made)

. 
. global controls female c.age##c.age i.educ i.wkstat i.regionid 

. 
. qui reg incomereport leave $controls, cl(subsid)

. estimate store incomereport

. qui reg savereport leave $controls, cl(subsid)

. estimate store savereport

. qui reg debtreport leave $controls, cl(subsid)

. estimate store debtreport

. qui reg rentreport leave $controls, cl(subsid)

. estimate store rentreport

. qui reg mortgagereport leave $controls, cl(subsid)

. estimate store mortgagereport

. qui reg homereport leave $controls, cl(subsid)

. estimate store homereport

. qui reg homeAMTreport leave $controls, cl(subsid)

. estimate store homeAMTreport

. 
. coefplot incomereport savereport debtreport rentreport mortgagereport homereport homeAMTreport, keep (leave) xline(0, lcolor(red) lstyle(solid)) aseq swapnames ///
> legend(off) mfcolor(white) mlcolor (black) ciopts(lpatt(solid)lcol(black)) msymbol(circle) ///
>  coeflabels(incomereport = "Income Reporting" ///
>                            debtreport = "Debt Reporting"  ///
>                            savereport = "Savings  Reporting" /// 
>                rentreport = "Rent Amount  Reporting" /// 
>                mortgagereport = "Mortgage Amount  Reporting" /// 
>                homereport = "Home Ownership  Reporting" /// 
>                homeAMTreport = "Home Amount  Reporting" )  msize(1.5)  xlabel(-.04 -.02 0 0.02 .04)

.                           
. graph export "$output/fig_a1boe.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_a1boe.pdf written in PDF format)

. restore

. 
. 
. ************************************************************************
. *                                                       4. Data Preparation
. ************************************************************************
. 
. do "$code/3-wealthgenerate"

. besw14b
(Written by R.              )
(994 real changes made, 994 to missing)
(10,464 missing values generated)
(8,865 real changes made)
(405 real changes made, 405 to missing)
(10,096 missing values generated)
(291 real changes made)
(286 real changes made)
(7,261 real changes made)
(1,867 real changes made)
(12,682 real changes made)
(9,099 missing values generated)
(9,099 real changes made)
supergroup_code: all characters numeric; replaced as byte

. program define bwealth
  1. *************************
. *** 1.1. Household Size
. *************************
. 
. ** Household Size = 1 * Head + .5 * Adult Member + .3 * Dependent_under18
. **anyone NOT living in the HOUSE is not included 
. gen adults = 1 if (profile_marital_statW14 == 3 | profile_marital_statW14 == 4 | profile_marital_statW14 == 5 | profile_marital_statW14 == 6) & sickElderlyInHouseW6_W14 == 0 // single, no adults dependents
  2. replace adults = 2 if (profile_marital_statW14 == 1 | profile_marital_statW14 == 2 | profile_marital_statW14 == 7) & sickElderlyInHouseW6_W14 == 0 // married, partner etc
  3. replace adults = 2 if (profile_marital_statW14 == 3 | profile_marital_statW14 == 4 | profile_marital_statW14 == 5 | profile_marital_statW14 == 6) & sickElderlyInHouseW6_W14 == 1 // single but adult dependent
  4. replace adults = 3 if (profile_marital_statW14 == 1 | profile_marital_statW14 == 2 | profile_marital_statW14 == 7) & sickElderlyInHouseW6_W14 == 1 // married, partner + adult dependent
  5. 
. replace numChildrenW14 = 0 if numChildrenW14 == 111
  6.  
. gen error1 = 1 if numChildrenW14 == 0 & preschoolKidsInHouseW6_W14 == 1 
  7. gen error2 = 1 if numChildrenW14 == 0 & schoolKidsInHouseW6_W14 == 1 
  8. gen error3 = 1 if numChildrenW14 == 0 & noDependentsInHouseW6_W14 == 0 &  sickElderlyInHouseW6_W14 == 0 
  9. 
. drop if error1 == 1 | error2 == 1 | error3 == 1 
 10. drop error1 error2 error3
 11. 
. gen kids = 0 if numChildrenW14 == 0 | (preschoolKidsInHouseW6_W14 == 0 & schoolKidsInHouseW6_W14 == 0) // if no kids below 18 in the house, i put 0 even if they have adult kids
 12. 
. replace kids = 1 if numChildrenW14 == 1 & preschoolKidsInHouseW6_W14 == 1 // 1 kid either in pre-school 
 13. replace kids = 1 if numChildrenW14 == 1 & schoolKidsInHouseW6_W14 == 1 // or in school
 14. 
. replace kids = 2 if numChildrenW14 == 2 & preschoolKidsInHouseW6_W14 == 1 // 1 kid either in pre-school 
 15. replace kids = 2 if numChildrenW14 == 2 & schoolKidsInHouseW6_W14 == 1 // or in school
 16. 
. replace kids = 3 if numChildrenW14 == 3 & preschoolKidsInHouseW6_W14 == 1 // 1 kid either in pre-school 
 17. replace kids = 3 if numChildrenW14 == 3 & schoolKidsInHouseW6_W14 == 1 // or in school
 18. 
. replace kids = 4 if numChildrenW14 == 4 & preschoolKidsInHouseW6_W14 == 1 // 1 kid either in pre-school 
 19. replace kids = 4 if numChildrenW14 == 4 & schoolKidsInHouseW6_W14 == 1 // or in school
 20. 
. replace kids = 5 if numChildrenW14 == 5 & preschoolKidsInHouseW6_W14 == 1 // 1 kid either in pre-school 
 21. replace kids = 5 if numChildrenW14 == 5 & schoolKidsInHouseW6_W14 == 1 // or in school
 22. 
. replace kids = 6 if numChildrenW14 == 6 & preschoolKidsInHouseW6_W14 == 1 // 1 kid either in pre-school 
 23. replace kids = 6 if numChildrenW14 == 6 & schoolKidsInHouseW6_W14 == 1 // or in school
 24. 
. 
. *household size
. 
. gen HHsize = 1 if adults == 1 & kids == 0 // single person, no kids
 25. replace HHsize = 1.3 if adults == 1 & kids == 1 // single person, 1 kid
 26. replace HHsize = 1.6 if adults == 1 & kids == 2 // single person, 2 kid
 27. replace HHsize = 1.9 if adults == 1 & kids == 3 // single person, 3 kid
 28. replace HHsize = 2.2 if adults == 1 & kids == 4 // single person, 4 kid
 29. replace HHsize = 2.5 if adults == 1 & kids == 5 // single person, 5 kid
 30. replace HHsize = 2.8 if adults == 1 & kids == 6 // single person, >5 kid
 31. 
. replace HHsize = 1.5 if adults == 2 & kids == 0 // couple or 1 adult + 1 adult dependent, no kids
 32. replace HHsize = 1.8 if adults == 2 & kids == 1 // couple, 1 kid
 33. replace HHsize = 2.1 if adults == 2 & kids == 2 // couple, 2 kid
 34. replace HHsize = 2.4 if adults == 2 & kids == 3 // couple, 3 kid
 35. replace HHsize = 2.7 if adults == 2 & kids == 4 // couple, 4 kid
 36. replace HHsize = 3 if adults == 2 & kids == 5 // couple, 5 kid
 37. replace HHsize = 3.3 if adults == 2 & kids == 6 // couple, >5 kid
 38. 
. replace HHsize = 2 if adults == 3 & kids == 0 // couple and 1 adult dependent, no kids
 39. replace HHsize = 2.3 if adults == 3 & kids == 1 // couple, 1 kid
 40. replace HHsize = 2.6 if adults == 3 & kids == 2 // couple, 2 kid
 41. replace HHsize = 2.9 if adults == 3 & kids == 3 // couple, 3 kid
 42. replace HHsize = 3.2 if adults == 3 & kids == 4 // couple, 4 kid
 43. replace HHsize = 3.5 if adults == 3 & kids == 5 // couple, 5 kid
 44. replace HHsize = 3.8 if adults == 3 & kids == 6 // couple, >5 kid
 45. 
. 
. *********************
. *1.2. Income Measure 
. *********************
. 
. gen mean_income = 2500 if profile_gross_householdW14 == 1
 46. replace mean_income = 7499.5 if profile_gross_householdW14 == 2
 47. replace mean_income = 12499.5 if profile_gross_householdW14 == 3
 48. replace mean_income = 17499.5 if profile_gross_householdW14 == 4
 49. replace mean_income = 22499.5 if profile_gross_householdW14 == 5
 50. replace mean_income = 27499.5 if profile_gross_householdW14 == 6
 51. replace mean_income = 32499.5 if profile_gross_householdW14 == 7
 52. replace mean_income = 37499.5 if profile_gross_householdW14 == 8
 53. replace mean_income = 42499.5 if profile_gross_householdW14 == 9
 54. replace mean_income = 47499.5 if profile_gross_householdW14 == 10
 55. replace mean_income = 54999.5 if profile_gross_householdW14 == 11
 56. replace mean_income = 64999.5 if profile_gross_householdW14 == 12
 57. replace mean_income = 84999.5 if profile_gross_householdW14 == 13
 58. replace mean_income = 124999.5 if profile_gross_householdW14 == 14
 59. 
. *************************
. *1.3. EQUIVALIZED INCOME
. **************************
. *1 if head, .5 addition, .3 for dependents <18
. 
. gen mean_HHincome = mean_income / HHsize
 60. 
. 
. *********************
. *CONSTRUCT WEALTH 
. *********************
. 
. ************
. *1.5. Debt
. ************
. replace  debtW14 = . if  debtW14 == 9999
 61. 
. gen mean_debt = 0 if debtW14 == 0  
 62. replace mean_debt = 49.5 if debtAmtbW14 == 1
 63. replace mean_debt = 299.5 if debtAmtbW14 == 2
 64. replace mean_debt = 749.5 if debtAmtbW14 == 3
 65. replace mean_debt = 1499.5 if debtAmtbW14 == 4
 66. replace mean_debt = 2499.5 if debtAmtbW14 == 5
 67. replace mean_debt = 3999.5 if debtAmtbW14 == 6
 68. replace mean_debt = 7499.5 if debtAmtbW14 == 7
 69. replace mean_debt = 12499.5 if debtAmtbW14 == 8
 70. replace mean_debt = 17499.5 if debtAmtbW14 == 9
 71. replace mean_debt = 24999.5 if debtAmtbW14 == 10
 72. replace mean_debt = 34999.5 if debtAmtbW14 == 11
 73. replace mean_debt = 44999.5 if debtAmtbW14 == 12
 74. replace mean_debt = 62499.5 if debtAmtbW14 == 13
 75. replace mean_debt = 87499.5 if debtAmtbW14 == 14
 76. replace mean_debt = 124999.5 if debtAmtbW14 == 15
 77. replace mean_debt = 174999.5 if debtAmtbW14 == 16
 78. 
. 
. ************
. *1.6 Savings
. ************
. 
. qui tab savingsW14
 79. replace savingsW14 = . if savingsW14 == 9999
 80.  
. gen mean_save = 0 if savingsW14 == 0 
 81. replace mean_save = 49.5 if savingsAmtbW14 ==  1
 82. replace mean_save = 299.5 if savingsAmtbW14 ==  2
 83. replace mean_save = 749.5 if savingsAmtbW14 ==  3
 84. replace mean_save = 1499.5 if savingsAmtbW14 ==  4
 85. replace mean_save = 2499.5 if savingsAmtbW14 ==  5
 86. replace mean_save = 3999.5 if savingsAmtbW14 ==  6
 87. replace mean_save = 7499.5 if savingsAmtbW14 ==  7
 88. replace mean_save = 12499.5 if savingsAmtbW14 == 8 
 89. replace mean_save = 17499.5 if savingsAmtbW14 ==  9
 90. replace mean_save = 24999.5 if savingsAmtbW14 == 10
 91. replace mean_save = 34999.5 if savingsAmtbW14 == 11
 92. replace mean_save = 44999.5 if savingsAmtbW14 == 12
 93. replace mean_save = 62499.5 if savingsAmtbW14 == 13
 94. replace mean_save = 87499.5 if savingsAmtbW14 == 14
 95. replace mean_save = 124999.5 if savingsAmtbW14 == 15
 96. replace mean_save = 174999.5 if savingsAmtbW14 == 16
 97.  
. 
. ************
. *1.7 Rent
. ************
. *Please estimate the proportion (%) of your household income, after tax, spent on your rent per month
. 
. replace rentPaymentW14 = . if  rentPaymentW14 == 9999
 98. drop if homeOwnW14 == 4 & rentPaymentW14  == 0
 99. 
. gen monthly_mean_income = mean_income / 12
100. gen yearly_rent =  (rentPaymentW14* monthly_mean_income) * 12 /   100
101. replace yearly_rent = 0 if homeOwnW14 == 1 | homeOwnW14 == 2 
102. 
. 
. ************
. *1.7 Mortage
. ************
. *Please estimate the proportion (%) of household income, after tax, spent on your mortgage per month:
. 
. replace mortgagePaymentW14 = . if mortgagePaymentW14 == 9999
103. drop if homeOwnW14 == 2 & mortgagePaymentW14  == 0 
104. 
. gen yearly_mortgage = (mortgagePaymentW14 * monthly_mean_income) * 12 / 100
105. replace yearly_mortgage = 0 if homeOwnW14  == 1 | homeOwnW14 == 3 | homeOwnW14  == 4 | homeOwnW14 == 5 
106. 
. *****************
. *1.8 Home Value 
. *****************
. 
. replace homeOwn = . if homeOwn == 9999
107. replace homeAmtb = . if homeAmtb == 9999
108. 
. gen homevalue = 0 if homeOwnW14 == 3 | homeOwnW14 == 4 | homeOwnW14 == 5 // no asset is renting
109. replace homevalue = 24999.5 if homeAmtbW14 ==  1
110. replace homevalue = 74999.5 if homeAmtbW14 ==  2
111. replace homevalue = 124999.5 if homeAmtbW14 ==  3
112. replace homevalue = 174999.5 if homeAmtbW14 ==  4
113. replace homevalue = 224999.5 if homeAmtbW14 ==  5
114. replace homevalue = 274999.5 if homeAmtbW14 ==  6
115. replace homevalue = 349999.5 if homeAmtbW14 ==  7
116. replace homevalue = 449999.5 if homeAmtbW14 ==   8
117. replace homevalue = 549999.5 if homeAmtbW14 ==  9
118. replace homevalue = 649999.5 if homeAmtbW14 == 10
119. replace homevalue = 749999.5 if homeAmtbW14 == 11
120. replace homevalue = 849999.5 if homeAmtbW14 == 12
121. replace homevalue = 949999.5 if homeAmtbW14 == 13
122. end

. 
. bwealth
(13,326 missing values generated)
(11,641 real changes made)
(515 real changes made)
(1,170 real changes made)
(0 real changes made)
(19,530 missing values generated)
(19,510 missing values generated)
(19,505 missing values generated)
(37 observations deleted)
(3,326 missing values generated)
(259 real changes made)
(512 real changes made)
(599 real changes made)
(1,017 real changes made)
(201 real changes made)
(401 real changes made)
(70 real changes made)
(118 real changes made)
(30 real changes made)
(47 real changes made)
(9 real changes made)
(28 real changes made)
(13,823 missing values generated)
(170 real changes made)
(212 real changes made)
(81 real changes made)
(33 real changes made)
(8 real changes made)
(7 real changes made)
(9,482 real changes made)
(580 real changes made)
(1,339 real changes made)
(489 real changes made)
(136 real changes made)
(61 real changes made)
(25 real changes made)
(1,015 real changes made)
(21 real changes made)
(65 real changes made)
(32 real changes made)
(19 real changes made)
(8 real changes made)
(5 real changes made)
(19,170 missing values generated)
(902 real changes made)
(1,601 real changes made)
(1,613 real changes made)
(1,629 real changes made)
(1,524 real changes made)
(1,232 real changes made)
(1,123 real changes made)
(854 real changes made)
(794 real changes made)
(1,003 real changes made)
(648 real changes made)
(911 real changes made)
(301 real changes made)
(5,050 missing values generated)
(1,232 real changes made, 1,232 to missing)
(6,131 missing values generated)
(69 real changes made)
(141 real changes made)
(178 real changes made)
(319 real changes made)
(346 real changes made)
(538 real changes made)
(843 real changes made)
(505 real changes made)
(313 real changes made)
(295 real changes made)
(130 real changes made)
(69 real changes made)
(85 real changes made)
(21 real changes made)
(9 real changes made)
(3 real changes made)
(1,819 real changes made, 1,819 to missing)
(14,754 missing values generated)
(51 real changes made)
(153 real changes made)
(221 real changes made)
(408 real changes made)
(393 real changes made)
(540 real changes made)
(984 real changes made)
(698 real changes made)
(502 real changes made)
(721 real changes made)
(451 real changes made)
(484 real changes made)
(693 real changes made)
(506 real changes made)
(535 real changes made)
(304 real changes made)
(1,715 real changes made, 1,715 to missing)
(13 observations deleted)
(5,034 missing values generated)
(17,057 missing values generated)
(14,630 real changes made)
(1,668 real changes made, 1,668 to missing)
(20 observations deleted)
(16,213 missing values generated)
(13,768 real changes made)
(375 real changes made, 375 to missing)
(2,554 real changes made, 2,554 to missing)
(14,985 missing values generated)
(142 real changes made)
(807 real changes made)
(1,891 real changes made)
(2,057 real changes made)
(1,660 real changes made)
(1,436 real changes made)
(1,776 real changes made)
(973 real changes made)
(517 real changes made)
(268 real changes made)
(181 real changes made)
(128 real changes made)
(78 real changes made)

. 
. keep if mean_income !=. & mean_HHincome !=. & HHsize !=. & mean_debt!=. & ///
> mean_save !=. & yearly_rent!=. & yearly_mortgage !=. & homevalue != .   
(10,521 observations deleted)

. 
. drop if leave == .  | al_scaleW14 == . | anyUniW14 == . | female == . | married == . |  ageW14 == . |  wkstat == . | onsAreaSupergroupW14 == . 
(1,321 observations deleted)

. 
. ********************************************************************************
. 
. 
. gen f_wealth = mean_save - mean_debt

. gen p_wealth = homevalue

. 
. 
. gen incomerent2 = mean_income - yearly_rent - yearly_mortgage

. 
. gen incomedisHH2 = incomerent2/HHsize

. gen f_wealthHH = f_wealth / HHsize

. gen p_wealthHH = p_wealth / HHsize

. 
. ** creating standarized measures
. egen z_income_disHH = std(incomedisHH2)

. egen z_f_wealth = std(f_wealthHH)

. egen z_p_wealth = std(p_wealthHH)

. 
. 
. *************
. * Figure B1
. *************
. 
. preserve

. gen poor2 = 1 if z_income_disHH <=0 & z_income_disHH <.
(2,987 missing values generated)

. replace  poor2= 0 if z_income_disHH >0 & z_income_disHH <.
(2,987 real changes made)

. 
. catplot poor2 homeOwnW14, ///
> percent(poor2) ///
> var1opts(label(labsize(small))) ///
> var2opts(label(labsize(small)) relabel(`r(relabel)')) ///
> ytitle("Percent of Respondents by Disposable Income (HH Adj)", size(small)) ///
> blabel(bar, format(%4.1f)) ///
> intensity(25) ///
> asyvars legend(on order(1 "High" 2 "Low"))

. graph export "$output/fig_b1.pdf",  replace
(file ~/Dropbox/Replication/BJPS/figures/fig_b1.pdf written in PDF format)

. restore

. 
. *************
. * Figure B2
. *************
. 
. preserve

. qui sum mean_save

. gen meanS =  r(mean)

. 
. gen lowsave = 1 if mean_save >=0 & mean_save <= meanS
(2,318 missing values generated)

. replace lowsave = 0 if mean_save >meanS & mean_save !=.
(2,318 real changes made)

. 
. twoway (kdensity z_income_disHH if lowsave == 0 , color(orange)  )  ///
>  (kdensity z_income_disHH if lowsave == 1, lpattern(solid) color(black) ), ///
>  legend(order(1 "High Saving" 2 "Low Saving")) xtitle("HH Adjusted Disposable Income") ytitle("Density") 

. graph export "$output/fig_b2.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_b2.pdf written in PDF format)

. restore

. 
. *************
. * Figure B3
. *************
. 
. preserve

. qui sum mean_debt

. gen meanD =  r(mean)

. 
. gen lowdebt = 1 if mean_debt >=0 & mean_debt <=meanD
(1,757 missing values generated)

. replace lowdebt = 0 if mean_debt >meanD & mean_debt !=.
(1,757 real changes made)

. 
. twoway (kdensity z_income_disHH if lowdebt == 0 , color(orange)  ) ///
>  (kdensity z_income_disHH if lowdebt == 1,  lpattern(solid) color(black) ), ///
>  legend(order(1 "High Debt" 2 "Low Debt")) xtitle("HH Adjusted Disposable Income") ytitle("Density")

. graph export "$output/fig_b3.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_b3.pdf written in PDF format)

. restore

. 
. *************
. * Figure C2
. *************
. 
. ********************************************************************************
. ** are leavers wealthier?
. 
. preserve

. qui reg z_p_wealth leave, r

. estimate store z_p_wealth

. qui reg z_f_wealth leave, r

. estimate store z_f_wealth

. 
. coefplot z_p_wealth z_f_wealth, xline(0) keep(leave) xline(0, lcolor(red) lstyle(solid)) msymbol(circle)   legend(off)  aseq swapnames  ///
> coeflabels(z_p_wealth = "Property Wealth" z_f_wealth = "Financial Wealth") ///
>  mfcolor(black) mlcolor (white) msize(2.5) ciopts(lpatt(solid)lcol(black)) xlabel(-.075  -.025 0 .025 .075) 

. graph export "$output/fig_c2.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c2.pdf written in PDF format)

. 
. ** mean not different, how about distributions? 
. 
. kdensity z_p_wealth if leave == 0, plot(kdensity z_p_wealth if leave == 1, lpattern("solid") lcolor("orange")) ///
>         legend(label(1 "Remain") label(2 "Leave") rows(2)) xtitle("Property Wealth") title(" ") note(" ")

. graph export "$output/fig_c21.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c21.pdf written in PDF format)

. qui ksmirnov z_p_wealth, by(leave) 

. 
. 
. kdensity z_f_wealth if leave == 0, plot(kdensity z_f_wealth if leave == 1, lpattern("solid") lcolor("orange")) ///
>         legend(label(1 "Remain") label(2 "Leave") rows(2))        xtitle("Property Wealth") title(" ") note(" ")

. graph export "$output/fig_c22.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c22.pdf written in PDF format)

. ksmirnov z_f_wealth, by(leave) 

Two-sample Kolmogorov-Smirnov test for equality of distribution functions

 Smaller group       D       P-value  
 -----------------------------------
 0:                  0.0228    0.138
 1:                 -0.0268    0.064
 Combined K-S:       0.0268    0.128

Note: Ties exist in combined dataset;
      there are 692 unique values out of 7627 observations.

. restore

. 
. *************
. * Figure C3
. *************
. 
. ********************************************************************************
. 
. ** who's wealthy?
. 
. preserve

. graph bar z_p_wealth, over(female,  relabel(1 "Male" 2 "Female"))  ytitle("Mean Property Wealth")   

. graph export "$output/fig_c3_des1.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c3_des1.pdf written in PDF format)

. graph bar z_p_wealth, over(married, relabel(1 "Not Married" 2 "Married")) ytitle("Mean Property Wealth") 

. graph export "$output/fig_c3_des2.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c3_des2.pdf written in PDF format)

. twoway (scatter z_p_wealth  ageW14,  msymbol(Uh) msize(2.5) mcolor(gs13%30)) (lfit z_p_wealth ageW14, lcolor("red") )  , legend(off) ytitle("Mean Property Wealth")
(note:  named style Uh not found in class symbol, default attributes used)

. graph export "$output/fig_c3_des3.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c3_des3.pdf written in PDF format)

. graph bar z_p_wealth, over(anyUniW14, relabel(1 "No" 2 "Enrolled" 3 "Left HE" 4 "Yes"))  ytitle("Mean Property Wealth") b1title("Higher Education")  

. graph export "$output/fig_c3_des4.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c3_des4.pdf written in PDF format)

. graph bar z_p_wealth , over(wkstat, relabel(1 "Employed" 2 "Unemployed" 3 "Student" 4 "Retired" 5 "Out of Labour Force"))  ytitle("Mean Property Wealth")

. graph export "$output/fig_c3_des5.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c3_des5.pdf written in PDF format)

. 
. 
. graph bar z_f_wealth, over(female,  relabel(1 "Male" 2 "Female"))  ytitle("Mean Financial Wealth") 

. graph export "$output/fig_c4_des1.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c4_des1.pdf written in PDF format)

. graph bar z_f_wealth, over(married, relabel(1 "Not Married" 2 "Married")) ytitle("Mean Financial Wealth") 

. graph export "$output/fig_c4_des2.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c4_des2.pdf written in PDF format)

. twoway (scatter z_f_wealth  ageW14,msymbol(Uh) msize(2.5) mcolor(gs13%30)) (lfit z_f_wealth ageW14, lcolor("red")) , legend(off) ytitle("Mean Financial Wealth")
(note:  named style Uh not found in class symbol, default attributes used)

. graph export "$output/fig_c4_des3.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c4_des3.pdf written in PDF format)

. graph bar z_f_wealth, over(anyUniW14, relabel(1 "No" 2 "Enrolled" 3 "Left HE" 4 "Yes"))  ytitle("Mean Financial Wealth") b1title("Higher Education")  

. graph export "$output/fig_c4_des4.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c4_des4.pdf written in PDF format)

. graph bar z_f_wealth , over(wkstat, relabel(1 "Employed" 2 "Unemployed" 3 "Student" 4 "Retired" 5 "Out of Labour Force"))  ytitle("Mean Financial Wealth")

. graph export "$output/fig_c4_des5.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_c4_des5.pdf written in PDF format)

. restore

. 
. *************
. * Figure D1
. *************
. 
. preserve

. besw14b
(Written by R.              )
(994 real changes made, 994 to missing)
(10,464 missing values generated)
(8,865 real changes made)
(405 real changes made, 405 to missing)
(10,096 missing values generated)
(291 real changes made)
(286 real changes made)
(7,261 real changes made)
(1,867 real changes made)
(12,682 real changes made)
(9,099 missing values generated)
(9,099 real changes made)
supergroup_code: all characters numeric; replaced as byte

. bwealth
(13,326 missing values generated)
(11,641 real changes made)
(515 real changes made)
(1,170 real changes made)
(0 real changes made)
(19,530 missing values generated)
(19,510 missing values generated)
(19,505 missing values generated)
(37 observations deleted)
(3,326 missing values generated)
(259 real changes made)
(512 real changes made)
(599 real changes made)
(1,017 real changes made)
(201 real changes made)
(401 real changes made)
(70 real changes made)
(118 real changes made)
(30 real changes made)
(47 real changes made)
(9 real changes made)
(28 real changes made)
(13,823 missing values generated)
(170 real changes made)
(212 real changes made)
(81 real changes made)
(33 real changes made)
(8 real changes made)
(7 real changes made)
(9,482 real changes made)
(580 real changes made)
(1,339 real changes made)
(489 real changes made)
(136 real changes made)
(61 real changes made)
(25 real changes made)
(1,015 real changes made)
(21 real changes made)
(65 real changes made)
(32 real changes made)
(19 real changes made)
(8 real changes made)
(5 real changes made)
(19,170 missing values generated)
(902 real changes made)
(1,601 real changes made)
(1,613 real changes made)
(1,629 real changes made)
(1,524 real changes made)
(1,232 real changes made)
(1,123 real changes made)
(854 real changes made)
(794 real changes made)
(1,003 real changes made)
(648 real changes made)
(911 real changes made)
(301 real changes made)
(5,050 missing values generated)
(1,232 real changes made, 1,232 to missing)
(6,131 missing values generated)
(69 real changes made)
(141 real changes made)
(178 real changes made)
(319 real changes made)
(346 real changes made)
(538 real changes made)
(843 real changes made)
(505 real changes made)
(313 real changes made)
(295 real changes made)
(130 real changes made)
(69 real changes made)
(85 real changes made)
(21 real changes made)
(9 real changes made)
(3 real changes made)
(1,819 real changes made, 1,819 to missing)
(14,754 missing values generated)
(51 real changes made)
(153 real changes made)
(221 real changes made)
(408 real changes made)
(393 real changes made)
(540 real changes made)
(984 real changes made)
(698 real changes made)
(502 real changes made)
(721 real changes made)
(451 real changes made)
(484 real changes made)
(693 real changes made)
(506 real changes made)
(535 real changes made)
(304 real changes made)
(1,715 real changes made, 1,715 to missing)
(13 observations deleted)
(5,034 missing values generated)
(17,057 missing values generated)
(14,630 real changes made)
(1,668 real changes made, 1,668 to missing)
(20 observations deleted)
(16,213 missing values generated)
(13,768 real changes made)
(375 real changes made, 375 to missing)
(2,554 real changes made, 2,554 to missing)
(14,985 missing values generated)
(142 real changes made)
(807 real changes made)
(1,891 real changes made)
(2,057 real changes made)
(1,660 real changes made)
(1,436 real changes made)
(1,776 real changes made)
(973 real changes made)
(517 real changes made)
(268 real changes made)
(181 real changes made)
(128 real changes made)
(78 real changes made)

. 
. gen homevalueDK = 1 if homevalue == .
(16,398 missing values generated)

. replace homevalueDK = 0 if homevalue!=.
(16,398 real changes made)

. 
. gen f_wealth = mean_save - mean_debt
(7,909 missing values generated)

. gen incomerent2 = mean_income - yearly_rent - yearly_mortgage
(7,212 missing values generated)

. 
. gen incomedisHH2 = incomerent2/HHsize
(7,218 missing values generated)

. gen f_wealthHH = f_wealth / HHsize
(7,912 missing values generated)

. 
. egen z_income_disHH = std(incomedisHH2)
(7,218 missing values generated)

. egen z_f_wealth = std(f_wealthHH)
(7,912 missing values generated)

. 
. qui reg leave z_income_disHH z_f_wealth $cfe  homevalueDK   , r

. regsave  using "$temp/figd1data", replace   ci
file ~/Dropbox/Replication/BJPS/temp/figd1data.dta saved

. restore

. 
end of do-file

. 
. preserve 

. keep EUIntegrationSelfW8 euRefVoteW9

. replace EUIntegrationSelfW8 = . if EUIntegrationSelfW8 == 9999
(158 real changes made, 158 to missing)

. gen leaveW9 = 1 if euRefVoteW9 == 1
(4,353 missing values generated)

. replace leaveW9 = 0 if euRefVoteW9 == 0
(3,134 real changes made)

. save "$temp/fig1data", replace
file ~/Dropbox/Replication/BJPS/temp/fig1data.dta saved

. restore

. 
. preserve

. 
. gen nochangeECON = 1 if effectsEUEconW14 == 3 
(5,409 missing values generated)

. replace nochangeECON = 0 if effectsEUEconW14 == 1 | effectsEUEconW14 == 2 | effectsEUEconW14 == 4 |effectsEUEconW14 ==5
(5,189 real changes made)

. 
. gen nochangePERSONAL =1 if effectsEUFinanceW14 == 3 
(2,805 missing values generated)

. replace nochangePERSONAL = 0 if effectsEUFinanceW14 == 1 | effectsEUFinanceW14 == 2 | effectsEUFinanceW14 ==4 | effectsEUFinanceW14 ==5
(2,480 real changes made)

. 
. 
. qui reg nochangeECON c.z_p_wealth z_income_disHH $cfe, r 

. qui margins, at(z_p_wealth = (-1 0 1 2)) post

. regsave  using "$temp/fig3data",  replace   ci
file ~/Dropbox/Replication/BJPS/temp/fig3data.dta saved

. 
. qui reg nochangePERSONAL c.z_p_wealth z_income_disHH $cfe, r 

. qui margins, at(z_p_wealth = (-1 0 1 2)) post

. regsave  using "$temp/fig3data",  append   ci
file ~/Dropbox/Replication/BJPS/temp/fig3data.dta saved

. restore

.  
. preserve

. 
. replace riskUnemploymentW14 = . if riskUnemploymentW14 == 9999
(496 real changes made, 496 to missing)

. 
. qui reg leave z_income_disHH z_f_wealth z_p_wealth $cfe riskUnemploymentW14,  r

. regsave using "$temp/figd2data", replace ci
(note: file /Users/raluca/Dropbox/Replication/BJPS/temp/figd2data.dta not found)
file ~/Dropbox/Replication/BJPS/temp/figd2data.dta saved

. 
. replace EUIntegrationSelfW14 = . if EUIntegrationSelfW14 == 9999
(148 real changes made, 148 to missing)

. qui reg leave z_income_disHH z_f_wealth z_p_wealth $cfe EUIntegrationSelfW14, r

. regsave using "$temp/figd2data", append ci
file ~/Dropbox/Replication/BJPS/temp/figd2data.dta saved

. 
. use "$temp/figd2data", clear

. keep if var == "z_f_wealth" | var == "z_p_wealth"
(50 observations deleted)

. save "$temp/figd2data_toplot", replace
file ~/Dropbox/Replication/BJPS/temp/figd2data_toplot.dta saved

. 
. rm "$temp/figd2data.dta"

. restore 

. 
. preserve

. 
. gen betterchangeECON = 1 if effectsEUEconW14 == 4 | effectsEUEconW14 == 5
(5,650 missing values generated)

. replace betterchangeECON = 0 if effectsEUEconW14 == 1 | effectsEUEconW14 == 2 
(3,212 real changes made)

. 
. gen betterchangePERSONAL =1 if effectsEUFinanceW14 == 4 | effectsEUFinanceW14 ==5 
(6,989 missing values generated)

. replace betterchangePERSONAL = 0 if effectsEUFinanceW14 == 1 | effectsEUFinanceW14 == 2 
(1,842 real changes made)

. 
. qui reg betterchangeECON c.z_p_wealth z_income_disHH $cfe, r 

. regsave  using "$temp/figd3data",  replace   ci
file ~/Dropbox/Replication/BJPS/temp/figd3data.dta saved

. 
. qui reg betterchangePERSONAL c.z_p_wealth z_income_disHH $cfe, r 

. regsave  using "$temp/figd3data",  append   ci
file ~/Dropbox/Replication/BJPS/temp/figd3data.dta saved

. 
. restore

.  
. 
. preserve

. program define b
  1. boe
  2. do "$code/3-wealthgenerateboe"
  3. end

. restore

.  
. program define yougov
  1. use "$input/yougov.dta", clear
  2. 
. gen treat = 1 if randgroup == 3
  3. replace treat = 0 if randgroup == 5
  4. 
. replace EUrefsatisfactionExp_1W19 = . if EUrefsatisfactionExp_1W19 == 12
  5. replace EUrefsatisfactionControl_1W19 = . if EUrefsatisfactionControl_1W19 == 12
  6. 
. gen outcome = EUrefsatisfactionExp_1W19 if treat == 1
  7. replace outcome = EUrefsatisfactionControl_1W19 if treat == 0
  8. 
. qui tab  anyUniW19 
  9. replace  anyUniW19  = . if  anyUniW19  == 9999
 10. 
. drop if anyUniW19 == . 
 11. 
. qui tab workingStatusW19
 12. 
. gen wkstat = 1 if workingStatusW19 == 1 |  workingStatusW19 == 2 | workingStatusW19 ==3 
 13. replace wkstat = 2 if workingStatusW19 == 4 // unemployed
 14. replace wkstat = 3 if workingStatusW19 == 5 | workingStatusW19 == 6  // student
 15. replace wkstat = 4 if workingStatusW19 == 7 // retired 
 16. replace wkstat = 5 if workingStatusW19 == 8 // not in paid work for any other reason
 17. drop if wkstat == . 
 18. 
. gen female = 1 if gender == 2
 19. replace female = 0 if gender == 1
 20.  
. global cfexp i.anyUniW19 i.wkstat female  ageW19
 21. 
. gen risk = 0 if expRiskIncomeW19 == 2 & expRiskIncomeaW19 == 2 
 22. replace risk = 1 if expRiskIncomeW19 == 2 & expRiskIncomeaW19 == 1
 23. replace risk = 2 if expRiskIncomeW19 == 1 & expRiskIncomebW19 == 2
 24. replace risk = 3 if expRiskIncomeW19 == 1 & expRiskIncomebW19 == 1 
 25. 
. replace risk = 0 if controlRiskIncomeW19 == 2 & controlRiskIncomeaW19 == 2
 26. replace risk = 1 if controlRiskIncomeW19 == 2 & controlRiskIncomeaW19 == 1 
 27. replace risk = 2 if controlRiskIncomeW19 == 1 & controlRiskIncomebW19 == 2 
 28. replace risk = 3 if controlRiskIncomeW19 == 1 & controlRiskIncomebW19 == 1 
 29. 
. 
. gen risktreat = 1 if randgroup  == 4
 30. replace risktreat = 0 if randgroup  == 6
 31. end

. 
. *************
. * Figure B4
. *************
. 
. preserve 

. b
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. ** Household Size
. 
. 
. qui tab numberchildren  

. 
. replace numberchildren = 5 if numberchildren >=5 &   numberchildren !=. 
(13 real changes made)

. replace otheradults = "6" if otheradults == "More than 6"
(16 real changes made)

. replace otheradults = "." if otheradults == "NA"
(0 real changes made)

. destring otheradults, replace
otheradults: all characters numeric; replaced as byte
(12012 missing values generated)

. 
. gen adults2014 = otheradults2014 + 1
(24,036 missing values generated)

. gen adults2015 = otheradults if year == 2015 
(24,030 missing values generated)

. replace adults2015 = adults2015 + 1
(6,007 real changes made)

. gen adults2016 = nadults if year == 2016
(24,026 missing values generated)

. gen adults2017 =  otheradults if year == 2017
(24,019 missing values generated)

. replace adults2017 = adults2017 + 1
(6,018 real changes made)

. gen adults2018 =  otheradults if year == 2018
(24,037 missing values generated)

. replace adults2018 = adults2018 + 1
(6,000 real changes made)

. 
. gen adults = adults2014  if year == 2014
(24,036 missing values generated)

. replace adults = adults2015 if year == 2015
(6,007 real changes made)

. replace adults = adults2016 if year == 2016
(6,011 real changes made)

. replace adults = adults2017 if year == 2017
(6,018 real changes made)

. replace adults = adults2018 if year == 2018
(6,000 real changes made)

. 
. replace adults = 5 if adults >=5 & adults !=. 
(293 real changes made)

. 
. gen adults_nohead = adults - 1

. 
. gen weight_adult = 0.5 * adults_nohead

. gen weight_kid = 0.3 * numberchildren

. 
. gen HHsize = 1 + weight_adult + weight_kid

. 
. gen incomeHH = fihhyr2_m / HHsize
(3,768 missing values generated)

. 
. 
. *** Mortgage
. 
. replace xpmg_m = "." if xpmg_m == "don't know"
(357 real changes made)

. replace xpmg_m = "." if xpmg_m == "refused"
(406 real changes made)

. replace xpmg_m = "." if xpmg_m == "NA"
(0 real changes made)

. replace xpmg_m = "." if xpmg_m == "Don't know"
(56 real changes made)

. replace xpmg_m = "." if xpmg_m == "Not applicable"
(4,181 real changes made)

. replace xpmg_m = "." if xpmg_m == "not applicable"
(16,348 real changes made)

. replace xpmg_m = "." if xpmg_m == "Refused"
(112 real changes made)

. destring xpmg_m, replace
xpmg_m: all characters numeric; replaced as int
(21460 missing values generated)

. rename xpmg_m mortgage_m

. gen mortgage_y = 12 * mortgage_m 
(21,460 missing values generated)

. 
. 
. *** Rent
. replace mrent = "." if mrent == "Don't know"
(275 real changes made)

. replace mrent = "." if mrent == "NA"
(12,188 real changes made)

. replace mrent = "." if mrent == "Prefer not to state"
(356 real changes made)

. destring mrent, replace
mrent: all characters numeric; replaced as long
(24827 missing values generated)

. gen rent_y = 12 * mrent
(24,827 missing values generated)

. 
. 
. **********************
. * Wealth 
. **********************
. 
. qui tab tenure

. 
. gen owner = 1 if tenure == "Owned mortgage" | tenure == "Owned outright"
(14,096 missing values generated)

. replace owner = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. replace homevalue = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace saveamount_m = "." if saveamount_m == "don't know"
(1,778 real changes made)

. replace saveamount_m = "." if saveamount_m == "refused"
(2,113 real changes made)

. replace saveamount_m = "." if saveamount_m == "NA"
(25 real changes made)

. destring saveamount, replace
saveamount_m: all characters numeric; replaced as double
(3916 missing values generated)

. 
. gen saveamount_y = 12 * saveamount_m 
(3,916 missing values generated)

. 
. replace nvesttot_m = "." if nvesttot_m == "refused"
(1,190 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "NA"
(44 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "Not applicable"
(1,010 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "not applicable"
(3,344 real changes made)

. 
. destring nvesttot_m, replace 
nvesttot_m: all characters numeric; replaced as long
(5588 missing values generated)

. rename nvesttot_m totalsaving

. 
. replace ustot_m = "." if ustot_m == "don't know"
(862 real changes made)

. replace ustot_m = "." if ustot_m == "refused"
(550 real changes made)

. replace ustot_m = "." if ustot_m == "NA"
(294 real changes made)

. replace ustot_m = "." if ustot_m == "Don't know"
(189 real changes made)

. replace ustot_m = "." if ustot_m == "Not applicable"
(2,934 real changes made)

. replace ustot_m = "." if ustot_m == "not applicable"
(5,883 real changes made)

. replace ustot_m = "." if ustot_m == "Refused"
(129 real changes made)

. destring ustot_m, replace
ustot_m: all characters numeric; replaced as long
(10841 missing values generated)

. rename ustot_m debtamount

. 
. 
. replace xpus_m = "." if xpus_m == "don't know"
(1,062 real changes made)

. replace xpus_m = "." if xpus_m == "refused"
(1,356 real changes made)

. replace xpus_m = "." if xpus_m == "NA"
(2,517 real changes made)

. replace xpus_m = "." if xpus_m == "Don't know"
(207 real changes made)

. replace xpus_m = "." if xpus_m == "Not applicable"
(2,934 real changes made)

. replace xpus_m = "." if xpus_m == "not applicable"
(8,153 real changes made)

. replace xpus_m = "." if xpus_m == "Refused"
(488 real changes made)

. destring xpus_m, replace
xpus_m: all characters numeric; replaced as int
(16717 missing values generated)

. rename xpus_m debt_m

. gen debt_y = 12 * debt_m
(16,717 missing values generated)

. gen totaldebt = debtamount
(10,841 missing values generated)

. 
. replace rent_y = 0 if owner == 1 
(15,941 real changes made)

. 
. replace mortgage_y = 0 if tenure == "Owned outright" | tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented" 
(16,573 real changes made)

. 
. replace totaldebt = 0 if us == "0" | us == "No"
(7,962 real changes made)

. 
. gen f_wealth = totalsaving - totaldebt
(6,754 missing values generated)

. gen p_wealth = homevalue 
(7,510 missing values generated)

. 
. gen f_wealthHH = f_wealth / HH
(6,754 missing values generated)

. gen p_wealthHH = p_wealth / HH
(7,510 missing values generated)

. 
. gen incomedis = fihhyr2_m - rent_y - mortgage_y
(11,931 missing values generated)

. gen incomedisHH = incomedis/ HH
(11,931 missing values generated)

. 
. 
. drop if leave == . | female == . | age == . | educ == . | wkstat == . | incomedisHH == . | f_wealth == . | p_wealth == .
(23,791 observations deleted)

. 
. rename subsid id

. sort id year

. 
. bysort id: egen af2 = mean(female)

. drop if af2 == .5 
(4 observations deleted)

. drop af2

. 
. egen z_income_disHH = std(incomedisHH)

. egen z_f_wealth = std(f_wealthHH)

. egen z_p_wealth = std(p_wealthHH)

. 
. 
. 
. 
end of do-file

. 
. gen poor2 = 1 if z_income_disHH <=0 & z_income_disHH <.
(2,543 missing values generated)

. replace  poor2= 0 if z_income_disHH >0 & z_income_disHH <.
(2,543 real changes made)

. 
. 
. catplot poor2 tenure, ///
> percent(poor2) ///
> var1opts(label(labsize(small))) ///
> var2opts(label(labsize(small)) relabel(`r(relabel)')) ///
> ytitle("Percent of Respondents by Richness ", size(small)) ///
> blabel(bar, format(%4.1f)) ///
> intensity(25) ///
> asyvars legend(on order(1 "High" 2 "Low"))

. graph export "$output/fig_b4.pdf",  replace
(file ~/Dropbox/Replication/BJPS/figures/fig_b4.pdf written in PDF format)

. restore

. 
. *************
. * Figure B5
. *************
. 
. preserve

. b
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. ** Household Size
. 
. 
. qui tab numberchildren  

. 
. replace numberchildren = 5 if numberchildren >=5 &   numberchildren !=. 
(13 real changes made)

. replace otheradults = "6" if otheradults == "More than 6"
(16 real changes made)

. replace otheradults = "." if otheradults == "NA"
(0 real changes made)

. destring otheradults, replace
otheradults: all characters numeric; replaced as byte
(12012 missing values generated)

. 
. gen adults2014 = otheradults2014 + 1
(24,036 missing values generated)

. gen adults2015 = otheradults if year == 2015 
(24,030 missing values generated)

. replace adults2015 = adults2015 + 1
(6,007 real changes made)

. gen adults2016 = nadults if year == 2016
(24,026 missing values generated)

. gen adults2017 =  otheradults if year == 2017
(24,019 missing values generated)

. replace adults2017 = adults2017 + 1
(6,018 real changes made)

. gen adults2018 =  otheradults if year == 2018
(24,037 missing values generated)

. replace adults2018 = adults2018 + 1
(6,000 real changes made)

. 
. gen adults = adults2014  if year == 2014
(24,036 missing values generated)

. replace adults = adults2015 if year == 2015
(6,007 real changes made)

. replace adults = adults2016 if year == 2016
(6,011 real changes made)

. replace adults = adults2017 if year == 2017
(6,018 real changes made)

. replace adults = adults2018 if year == 2018
(6,000 real changes made)

. 
. replace adults = 5 if adults >=5 & adults !=. 
(293 real changes made)

. 
. gen adults_nohead = adults - 1

. 
. gen weight_adult = 0.5 * adults_nohead

. gen weight_kid = 0.3 * numberchildren

. 
. gen HHsize = 1 + weight_adult + weight_kid

. 
. gen incomeHH = fihhyr2_m / HHsize
(3,768 missing values generated)

. 
. 
. *** Mortgage
. 
. replace xpmg_m = "." if xpmg_m == "don't know"
(357 real changes made)

. replace xpmg_m = "." if xpmg_m == "refused"
(406 real changes made)

. replace xpmg_m = "." if xpmg_m == "NA"
(0 real changes made)

. replace xpmg_m = "." if xpmg_m == "Don't know"
(56 real changes made)

. replace xpmg_m = "." if xpmg_m == "Not applicable"
(4,181 real changes made)

. replace xpmg_m = "." if xpmg_m == "not applicable"
(16,348 real changes made)

. replace xpmg_m = "." if xpmg_m == "Refused"
(112 real changes made)

. destring xpmg_m, replace
xpmg_m: all characters numeric; replaced as int
(21460 missing values generated)

. rename xpmg_m mortgage_m

. gen mortgage_y = 12 * mortgage_m 
(21,460 missing values generated)

. 
. 
. *** Rent
. replace mrent = "." if mrent == "Don't know"
(275 real changes made)

. replace mrent = "." if mrent == "NA"
(12,188 real changes made)

. replace mrent = "." if mrent == "Prefer not to state"
(356 real changes made)

. destring mrent, replace
mrent: all characters numeric; replaced as long
(24827 missing values generated)

. gen rent_y = 12 * mrent
(24,827 missing values generated)

. 
. 
. **********************
. * Wealth 
. **********************
. 
. qui tab tenure

. 
. gen owner = 1 if tenure == "Owned mortgage" | tenure == "Owned outright"
(14,096 missing values generated)

. replace owner = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. replace homevalue = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace saveamount_m = "." if saveamount_m == "don't know"
(1,778 real changes made)

. replace saveamount_m = "." if saveamount_m == "refused"
(2,113 real changes made)

. replace saveamount_m = "." if saveamount_m == "NA"
(25 real changes made)

. destring saveamount, replace
saveamount_m: all characters numeric; replaced as double
(3916 missing values generated)

. 
. gen saveamount_y = 12 * saveamount_m 
(3,916 missing values generated)

. 
. replace nvesttot_m = "." if nvesttot_m == "refused"
(1,190 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "NA"
(44 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "Not applicable"
(1,010 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "not applicable"
(3,344 real changes made)

. 
. destring nvesttot_m, replace 
nvesttot_m: all characters numeric; replaced as long
(5588 missing values generated)

. rename nvesttot_m totalsaving

. 
. replace ustot_m = "." if ustot_m == "don't know"
(862 real changes made)

. replace ustot_m = "." if ustot_m == "refused"
(550 real changes made)

. replace ustot_m = "." if ustot_m == "NA"
(294 real changes made)

. replace ustot_m = "." if ustot_m == "Don't know"
(189 real changes made)

. replace ustot_m = "." if ustot_m == "Not applicable"
(2,934 real changes made)

. replace ustot_m = "." if ustot_m == "not applicable"
(5,883 real changes made)

. replace ustot_m = "." if ustot_m == "Refused"
(129 real changes made)

. destring ustot_m, replace
ustot_m: all characters numeric; replaced as long
(10841 missing values generated)

. rename ustot_m debtamount

. 
. 
. replace xpus_m = "." if xpus_m == "don't know"
(1,062 real changes made)

. replace xpus_m = "." if xpus_m == "refused"
(1,356 real changes made)

. replace xpus_m = "." if xpus_m == "NA"
(2,517 real changes made)

. replace xpus_m = "." if xpus_m == "Don't know"
(207 real changes made)

. replace xpus_m = "." if xpus_m == "Not applicable"
(2,934 real changes made)

. replace xpus_m = "." if xpus_m == "not applicable"
(8,153 real changes made)

. replace xpus_m = "." if xpus_m == "Refused"
(488 real changes made)

. destring xpus_m, replace
xpus_m: all characters numeric; replaced as int
(16717 missing values generated)

. rename xpus_m debt_m

. gen debt_y = 12 * debt_m
(16,717 missing values generated)

. gen totaldebt = debtamount
(10,841 missing values generated)

. 
. replace rent_y = 0 if owner == 1 
(15,941 real changes made)

. 
. replace mortgage_y = 0 if tenure == "Owned outright" | tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented" 
(16,573 real changes made)

. 
. replace totaldebt = 0 if us == "0" | us == "No"
(7,962 real changes made)

. 
. gen f_wealth = totalsaving - totaldebt
(6,754 missing values generated)

. gen p_wealth = homevalue 
(7,510 missing values generated)

. 
. gen f_wealthHH = f_wealth / HH
(6,754 missing values generated)

. gen p_wealthHH = p_wealth / HH
(7,510 missing values generated)

. 
. gen incomedis = fihhyr2_m - rent_y - mortgage_y
(11,931 missing values generated)

. gen incomedisHH = incomedis/ HH
(11,931 missing values generated)

. 
. 
. drop if leave == . | female == . | age == . | educ == . | wkstat == . | incomedisHH == . | f_wealth == . | p_wealth == .
(23,791 observations deleted)

. 
. rename subsid id

. sort id year

. 
. bysort id: egen af2 = mean(female)

. drop if af2 == .5 
(4 observations deleted)

. drop af2

. 
. egen z_income_disHH = std(incomedisHH)

. egen z_f_wealth = std(f_wealthHH)

. egen z_p_wealth = std(p_wealthHH)

. 
. 
. 
. 
end of do-file

. qui sum totalsaving

. gen meanS =  r(mean)

. 
. gen lowsave = 1 if totalsaving >=0 & totalsaving <= meanS
(1,613 missing values generated)

. replace lowsave = 0 if totalsaving >meanS & totalsaving !=.
(1,613 real changes made)

. 
. twoway (kdensity z_income_disHH if lowsave == 0 , color(orange)  )  ///
>  (kdensity z_income_disHH if lowsave == 1, lpattern(solid) color(black) ), ///
>  legend(order(1 "High Saving" 2 "Low Saving")) xtitle("HH Adjusted Disposable Income") ytitle("Density")

. graph export "$output/fig_b5.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_b5.pdf written in PDF format)

. restore

. 
. *************
. * Figure B6
. *************
. 
. preserve

. b
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. ** Household Size
. 
. 
. qui tab numberchildren  

. 
. replace numberchildren = 5 if numberchildren >=5 &   numberchildren !=. 
(13 real changes made)

. replace otheradults = "6" if otheradults == "More than 6"
(16 real changes made)

. replace otheradults = "." if otheradults == "NA"
(0 real changes made)

. destring otheradults, replace
otheradults: all characters numeric; replaced as byte
(12012 missing values generated)

. 
. gen adults2014 = otheradults2014 + 1
(24,036 missing values generated)

. gen adults2015 = otheradults if year == 2015 
(24,030 missing values generated)

. replace adults2015 = adults2015 + 1
(6,007 real changes made)

. gen adults2016 = nadults if year == 2016
(24,026 missing values generated)

. gen adults2017 =  otheradults if year == 2017
(24,019 missing values generated)

. replace adults2017 = adults2017 + 1
(6,018 real changes made)

. gen adults2018 =  otheradults if year == 2018
(24,037 missing values generated)

. replace adults2018 = adults2018 + 1
(6,000 real changes made)

. 
. gen adults = adults2014  if year == 2014
(24,036 missing values generated)

. replace adults = adults2015 if year == 2015
(6,007 real changes made)

. replace adults = adults2016 if year == 2016
(6,011 real changes made)

. replace adults = adults2017 if year == 2017
(6,018 real changes made)

. replace adults = adults2018 if year == 2018
(6,000 real changes made)

. 
. replace adults = 5 if adults >=5 & adults !=. 
(293 real changes made)

. 
. gen adults_nohead = adults - 1

. 
. gen weight_adult = 0.5 * adults_nohead

. gen weight_kid = 0.3 * numberchildren

. 
. gen HHsize = 1 + weight_adult + weight_kid

. 
. gen incomeHH = fihhyr2_m / HHsize
(3,768 missing values generated)

. 
. 
. *** Mortgage
. 
. replace xpmg_m = "." if xpmg_m == "don't know"
(357 real changes made)

. replace xpmg_m = "." if xpmg_m == "refused"
(406 real changes made)

. replace xpmg_m = "." if xpmg_m == "NA"
(0 real changes made)

. replace xpmg_m = "." if xpmg_m == "Don't know"
(56 real changes made)

. replace xpmg_m = "." if xpmg_m == "Not applicable"
(4,181 real changes made)

. replace xpmg_m = "." if xpmg_m == "not applicable"
(16,348 real changes made)

. replace xpmg_m = "." if xpmg_m == "Refused"
(112 real changes made)

. destring xpmg_m, replace
xpmg_m: all characters numeric; replaced as int
(21460 missing values generated)

. rename xpmg_m mortgage_m

. gen mortgage_y = 12 * mortgage_m 
(21,460 missing values generated)

. 
. 
. *** Rent
. replace mrent = "." if mrent == "Don't know"
(275 real changes made)

. replace mrent = "." if mrent == "NA"
(12,188 real changes made)

. replace mrent = "." if mrent == "Prefer not to state"
(356 real changes made)

. destring mrent, replace
mrent: all characters numeric; replaced as long
(24827 missing values generated)

. gen rent_y = 12 * mrent
(24,827 missing values generated)

. 
. 
. **********************
. * Wealth 
. **********************
. 
. qui tab tenure

. 
. gen owner = 1 if tenure == "Owned mortgage" | tenure == "Owned outright"
(14,096 missing values generated)

. replace owner = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. replace homevalue = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace saveamount_m = "." if saveamount_m == "don't know"
(1,778 real changes made)

. replace saveamount_m = "." if saveamount_m == "refused"
(2,113 real changes made)

. replace saveamount_m = "." if saveamount_m == "NA"
(25 real changes made)

. destring saveamount, replace
saveamount_m: all characters numeric; replaced as double
(3916 missing values generated)

. 
. gen saveamount_y = 12 * saveamount_m 
(3,916 missing values generated)

. 
. replace nvesttot_m = "." if nvesttot_m == "refused"
(1,190 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "NA"
(44 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "Not applicable"
(1,010 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "not applicable"
(3,344 real changes made)

. 
. destring nvesttot_m, replace 
nvesttot_m: all characters numeric; replaced as long
(5588 missing values generated)

. rename nvesttot_m totalsaving

. 
. replace ustot_m = "." if ustot_m == "don't know"
(862 real changes made)

. replace ustot_m = "." if ustot_m == "refused"
(550 real changes made)

. replace ustot_m = "." if ustot_m == "NA"
(294 real changes made)

. replace ustot_m = "." if ustot_m == "Don't know"
(189 real changes made)

. replace ustot_m = "." if ustot_m == "Not applicable"
(2,934 real changes made)

. replace ustot_m = "." if ustot_m == "not applicable"
(5,883 real changes made)

. replace ustot_m = "." if ustot_m == "Refused"
(129 real changes made)

. destring ustot_m, replace
ustot_m: all characters numeric; replaced as long
(10841 missing values generated)

. rename ustot_m debtamount

. 
. 
. replace xpus_m = "." if xpus_m == "don't know"
(1,062 real changes made)

. replace xpus_m = "." if xpus_m == "refused"
(1,356 real changes made)

. replace xpus_m = "." if xpus_m == "NA"
(2,517 real changes made)

. replace xpus_m = "." if xpus_m == "Don't know"
(207 real changes made)

. replace xpus_m = "." if xpus_m == "Not applicable"
(2,934 real changes made)

. replace xpus_m = "." if xpus_m == "not applicable"
(8,153 real changes made)

. replace xpus_m = "." if xpus_m == "Refused"
(488 real changes made)

. destring xpus_m, replace
xpus_m: all characters numeric; replaced as int
(16717 missing values generated)

. rename xpus_m debt_m

. gen debt_y = 12 * debt_m
(16,717 missing values generated)

. gen totaldebt = debtamount
(10,841 missing values generated)

. 
. replace rent_y = 0 if owner == 1 
(15,941 real changes made)

. 
. replace mortgage_y = 0 if tenure == "Owned outright" | tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented" 
(16,573 real changes made)

. 
. replace totaldebt = 0 if us == "0" | us == "No"
(7,962 real changes made)

. 
. gen f_wealth = totalsaving - totaldebt
(6,754 missing values generated)

. gen p_wealth = homevalue 
(7,510 missing values generated)

. 
. gen f_wealthHH = f_wealth / HH
(6,754 missing values generated)

. gen p_wealthHH = p_wealth / HH
(7,510 missing values generated)

. 
. gen incomedis = fihhyr2_m - rent_y - mortgage_y
(11,931 missing values generated)

. gen incomedisHH = incomedis/ HH
(11,931 missing values generated)

. 
. 
. drop if leave == . | female == . | age == . | educ == . | wkstat == . | incomedisHH == . | f_wealth == . | p_wealth == .
(23,791 observations deleted)

. 
. rename subsid id

. sort id year

. 
. bysort id: egen af2 = mean(female)

. drop if af2 == .5 
(4 observations deleted)

. drop af2

. 
. egen z_income_disHH = std(incomedisHH)

. egen z_f_wealth = std(f_wealthHH)

. egen z_p_wealth = std(p_wealthHH)

. 
. 
. 
. 
end of do-file

. qui sum totaldebt

. gen meanD =  r(mean)

. 
. gen lowdebt = 1 if totaldebt >=0 & totaldebt <=meanD
(1,422 missing values generated)

. replace lowdebt = 0 if totaldebt >meanD & totaldebt !=.
(1,422 real changes made)

. 
. twoway (kdensity z_income_disHH if lowdebt == 0 , color(orange)  ) ///
>  (kdensity z_income_disHH if lowdebt == 1,  lpattern(solid) color(black) ), ///
>  legend(order(1 "High Debt" 2 "Low Debt")) xtitle("HH Adjusted Disposable Income") ytitle("Density")

. graph export "$output/fig_b6.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fig_b6.pdf written in PDF format)

. 
. restore

. 
. 
. *************
. * Figure D5
. *************
. 
. preserve 

. b
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. ** Household Size
. 
. 
. qui tab numberchildren  

. 
. replace numberchildren = 5 if numberchildren >=5 &   numberchildren !=. 
(13 real changes made)

. replace otheradults = "6" if otheradults == "More than 6"
(16 real changes made)

. replace otheradults = "." if otheradults == "NA"
(0 real changes made)

. destring otheradults, replace
otheradults: all characters numeric; replaced as byte
(12012 missing values generated)

. 
. gen adults2014 = otheradults2014 + 1
(24,036 missing values generated)

. gen adults2015 = otheradults if year == 2015 
(24,030 missing values generated)

. replace adults2015 = adults2015 + 1
(6,007 real changes made)

. gen adults2016 = nadults if year == 2016
(24,026 missing values generated)

. gen adults2017 =  otheradults if year == 2017
(24,019 missing values generated)

. replace adults2017 = adults2017 + 1
(6,018 real changes made)

. gen adults2018 =  otheradults if year == 2018
(24,037 missing values generated)

. replace adults2018 = adults2018 + 1
(6,000 real changes made)

. 
. gen adults = adults2014  if year == 2014
(24,036 missing values generated)

. replace adults = adults2015 if year == 2015
(6,007 real changes made)

. replace adults = adults2016 if year == 2016
(6,011 real changes made)

. replace adults = adults2017 if year == 2017
(6,018 real changes made)

. replace adults = adults2018 if year == 2018
(6,000 real changes made)

. 
. replace adults = 5 if adults >=5 & adults !=. 
(293 real changes made)

. 
. gen adults_nohead = adults - 1

. 
. gen weight_adult = 0.5 * adults_nohead

. gen weight_kid = 0.3 * numberchildren

. 
. gen HHsize = 1 + weight_adult + weight_kid

. 
. gen incomeHH = fihhyr2_m / HHsize
(3,768 missing values generated)

. 
. 
. *** Mortgage
. 
. replace xpmg_m = "." if xpmg_m == "don't know"
(357 real changes made)

. replace xpmg_m = "." if xpmg_m == "refused"
(406 real changes made)

. replace xpmg_m = "." if xpmg_m == "NA"
(0 real changes made)

. replace xpmg_m = "." if xpmg_m == "Don't know"
(56 real changes made)

. replace xpmg_m = "." if xpmg_m == "Not applicable"
(4,181 real changes made)

. replace xpmg_m = "." if xpmg_m == "not applicable"
(16,348 real changes made)

. replace xpmg_m = "." if xpmg_m == "Refused"
(112 real changes made)

. destring xpmg_m, replace
xpmg_m: all characters numeric; replaced as int
(21460 missing values generated)

. rename xpmg_m mortgage_m

. gen mortgage_y = 12 * mortgage_m 
(21,460 missing values generated)

. 
. 
. *** Rent
. replace mrent = "." if mrent == "Don't know"
(275 real changes made)

. replace mrent = "." if mrent == "NA"
(12,188 real changes made)

. replace mrent = "." if mrent == "Prefer not to state"
(356 real changes made)

. destring mrent, replace
mrent: all characters numeric; replaced as long
(24827 missing values generated)

. gen rent_y = 12 * mrent
(24,827 missing values generated)

. 
. 
. **********************
. * Wealth 
. **********************
. 
. qui tab tenure

. 
. gen owner = 1 if tenure == "Owned mortgage" | tenure == "Owned outright"
(14,096 missing values generated)

. replace owner = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. replace homevalue = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace saveamount_m = "." if saveamount_m == "don't know"
(1,778 real changes made)

. replace saveamount_m = "." if saveamount_m == "refused"
(2,113 real changes made)

. replace saveamount_m = "." if saveamount_m == "NA"
(25 real changes made)

. destring saveamount, replace
saveamount_m: all characters numeric; replaced as double
(3916 missing values generated)

. 
. gen saveamount_y = 12 * saveamount_m 
(3,916 missing values generated)

. 
. replace nvesttot_m = "." if nvesttot_m == "refused"
(1,190 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "NA"
(44 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "Not applicable"
(1,010 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "not applicable"
(3,344 real changes made)

. 
. destring nvesttot_m, replace 
nvesttot_m: all characters numeric; replaced as long
(5588 missing values generated)

. rename nvesttot_m totalsaving

. 
. replace ustot_m = "." if ustot_m == "don't know"
(862 real changes made)

. replace ustot_m = "." if ustot_m == "refused"
(550 real changes made)

. replace ustot_m = "." if ustot_m == "NA"
(294 real changes made)

. replace ustot_m = "." if ustot_m == "Don't know"
(189 real changes made)

. replace ustot_m = "." if ustot_m == "Not applicable"
(2,934 real changes made)

. replace ustot_m = "." if ustot_m == "not applicable"
(5,883 real changes made)

. replace ustot_m = "." if ustot_m == "Refused"
(129 real changes made)

. destring ustot_m, replace
ustot_m: all characters numeric; replaced as long
(10841 missing values generated)

. rename ustot_m debtamount

. 
. 
. replace xpus_m = "." if xpus_m == "don't know"
(1,062 real changes made)

. replace xpus_m = "." if xpus_m == "refused"
(1,356 real changes made)

. replace xpus_m = "." if xpus_m == "NA"
(2,517 real changes made)

. replace xpus_m = "." if xpus_m == "Don't know"
(207 real changes made)

. replace xpus_m = "." if xpus_m == "Not applicable"
(2,934 real changes made)

. replace xpus_m = "." if xpus_m == "not applicable"
(8,153 real changes made)

. replace xpus_m = "." if xpus_m == "Refused"
(488 real changes made)

. destring xpus_m, replace
xpus_m: all characters numeric; replaced as int
(16717 missing values generated)

. rename xpus_m debt_m

. gen debt_y = 12 * debt_m
(16,717 missing values generated)

. gen totaldebt = debtamount
(10,841 missing values generated)

. 
. replace rent_y = 0 if owner == 1 
(15,941 real changes made)

. 
. replace mortgage_y = 0 if tenure == "Owned outright" | tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented" 
(16,573 real changes made)

. 
. replace totaldebt = 0 if us == "0" | us == "No"
(7,962 real changes made)

. 
. gen f_wealth = totalsaving - totaldebt
(6,754 missing values generated)

. gen p_wealth = homevalue 
(7,510 missing values generated)

. 
. gen f_wealthHH = f_wealth / HH
(6,754 missing values generated)

. gen p_wealthHH = p_wealth / HH
(7,510 missing values generated)

. 
. gen incomedis = fihhyr2_m - rent_y - mortgage_y
(11,931 missing values generated)

. gen incomedisHH = incomedis/ HH
(11,931 missing values generated)

. 
. 
. drop if leave == . | female == . | age == . | educ == . | wkstat == . | incomedisHH == . | f_wealth == . | p_wealth == .
(23,791 observations deleted)

. 
. rename subsid id

. sort id year

. 
. bysort id: egen af2 = mean(female)

. drop if af2 == .5 
(4 observations deleted)

. drop af2

. 
. egen z_income_disHH = std(incomedisHH)

. egen z_f_wealth = std(f_wealthHH)

. egen z_p_wealth = std(p_wealthHH)

. 
. 
. 
. 
end of do-file

. do "$code/9-figd5"

. /***********************************************
> Figure D5: Respondents Do Not Believe Post-Brexit Prices are Changing as a function of Property Wealth (BoE Sample)
> ***********************************************/
. 
. gen home_price_change = 1 if hpexp1 == "Decrease by 1%-4.9%" | hpexp1 == "Decrease by 10%-20%" | hpexp1 == "Decrease by 5%-9.9%" | hpexp1 == "Decrease by more than 20%" // decrease
(4,868 missing values generated)

. replace home_price_change = 1 if hpexp1 == "Increase by 1%-4.9%" | hpexp1 == "Increase bt 10%-20%" | hpexp1 == "Increase by 5%-9.9%" | hpexp1 == "Increase by more than 20%" // increase
(2,292 real changes made)

. replace home_price_change = 0 if hpexp1 == "No change"
(1,469 real changes made)

. 
. qui reg home_price_change z_p_wealth z_income_disHH $cfef, cl (id)

. qui margins, at(z_p_wealth = (-1 0 1 2 3 4 5 6 )) post

. marginsplot, xtitle("Property Wealth")

  Variables that uniquely identify margins: z_p_wealth

. graph export "$output/figd5.pdf",  replace
(file ~/Dropbox/Replication/BJPS/figures/figd5.pdf written in PDF format)

. 
. 
end of do-file

. restore

. 
. preserve

. b
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. ** Household Size
. 
. 
. qui tab numberchildren  

. 
. replace numberchildren = 5 if numberchildren >=5 &   numberchildren !=. 
(13 real changes made)

. replace otheradults = "6" if otheradults == "More than 6"
(16 real changes made)

. replace otheradults = "." if otheradults == "NA"
(0 real changes made)

. destring otheradults, replace
otheradults: all characters numeric; replaced as byte
(12012 missing values generated)

. 
. gen adults2014 = otheradults2014 + 1
(24,036 missing values generated)

. gen adults2015 = otheradults if year == 2015 
(24,030 missing values generated)

. replace adults2015 = adults2015 + 1
(6,007 real changes made)

. gen adults2016 = nadults if year == 2016
(24,026 missing values generated)

. gen adults2017 =  otheradults if year == 2017
(24,019 missing values generated)

. replace adults2017 = adults2017 + 1
(6,018 real changes made)

. gen adults2018 =  otheradults if year == 2018
(24,037 missing values generated)

. replace adults2018 = adults2018 + 1
(6,000 real changes made)

. 
. gen adults = adults2014  if year == 2014
(24,036 missing values generated)

. replace adults = adults2015 if year == 2015
(6,007 real changes made)

. replace adults = adults2016 if year == 2016
(6,011 real changes made)

. replace adults = adults2017 if year == 2017
(6,018 real changes made)

. replace adults = adults2018 if year == 2018
(6,000 real changes made)

. 
. replace adults = 5 if adults >=5 & adults !=. 
(293 real changes made)

. 
. gen adults_nohead = adults - 1

. 
. gen weight_adult = 0.5 * adults_nohead

. gen weight_kid = 0.3 * numberchildren

. 
. gen HHsize = 1 + weight_adult + weight_kid

. 
. gen incomeHH = fihhyr2_m / HHsize
(3,768 missing values generated)

. 
. 
. *** Mortgage
. 
. replace xpmg_m = "." if xpmg_m == "don't know"
(357 real changes made)

. replace xpmg_m = "." if xpmg_m == "refused"
(406 real changes made)

. replace xpmg_m = "." if xpmg_m == "NA"
(0 real changes made)

. replace xpmg_m = "." if xpmg_m == "Don't know"
(56 real changes made)

. replace xpmg_m = "." if xpmg_m == "Not applicable"
(4,181 real changes made)

. replace xpmg_m = "." if xpmg_m == "not applicable"
(16,348 real changes made)

. replace xpmg_m = "." if xpmg_m == "Refused"
(112 real changes made)

. destring xpmg_m, replace
xpmg_m: all characters numeric; replaced as int
(21460 missing values generated)

. rename xpmg_m mortgage_m

. gen mortgage_y = 12 * mortgage_m 
(21,460 missing values generated)

. 
. 
. *** Rent
. replace mrent = "." if mrent == "Don't know"
(275 real changes made)

. replace mrent = "." if mrent == "NA"
(12,188 real changes made)

. replace mrent = "." if mrent == "Prefer not to state"
(356 real changes made)

. destring mrent, replace
mrent: all characters numeric; replaced as long
(24827 missing values generated)

. gen rent_y = 12 * mrent
(24,827 missing values generated)

. 
. 
. **********************
. * Wealth 
. **********************
. 
. qui tab tenure

. 
. gen owner = 1 if tenure == "Owned mortgage" | tenure == "Owned outright"
(14,096 missing values generated)

. replace owner = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. replace homevalue = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace saveamount_m = "." if saveamount_m == "don't know"
(1,778 real changes made)

. replace saveamount_m = "." if saveamount_m == "refused"
(2,113 real changes made)

. replace saveamount_m = "." if saveamount_m == "NA"
(25 real changes made)

. destring saveamount, replace
saveamount_m: all characters numeric; replaced as double
(3916 missing values generated)

. 
. gen saveamount_y = 12 * saveamount_m 
(3,916 missing values generated)

. 
. replace nvesttot_m = "." if nvesttot_m == "refused"
(1,190 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "NA"
(44 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "Not applicable"
(1,010 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "not applicable"
(3,344 real changes made)

. 
. destring nvesttot_m, replace 
nvesttot_m: all characters numeric; replaced as long
(5588 missing values generated)

. rename nvesttot_m totalsaving

. 
. replace ustot_m = "." if ustot_m == "don't know"
(862 real changes made)

. replace ustot_m = "." if ustot_m == "refused"
(550 real changes made)

. replace ustot_m = "." if ustot_m == "NA"
(294 real changes made)

. replace ustot_m = "." if ustot_m == "Don't know"
(189 real changes made)

. replace ustot_m = "." if ustot_m == "Not applicable"
(2,934 real changes made)

. replace ustot_m = "." if ustot_m == "not applicable"
(5,883 real changes made)

. replace ustot_m = "." if ustot_m == "Refused"
(129 real changes made)

. destring ustot_m, replace
ustot_m: all characters numeric; replaced as long
(10841 missing values generated)

. rename ustot_m debtamount

. 
. 
. replace xpus_m = "." if xpus_m == "don't know"
(1,062 real changes made)

. replace xpus_m = "." if xpus_m == "refused"
(1,356 real changes made)

. replace xpus_m = "." if xpus_m == "NA"
(2,517 real changes made)

. replace xpus_m = "." if xpus_m == "Don't know"
(207 real changes made)

. replace xpus_m = "." if xpus_m == "Not applicable"
(2,934 real changes made)

. replace xpus_m = "." if xpus_m == "not applicable"
(8,153 real changes made)

. replace xpus_m = "." if xpus_m == "Refused"
(488 real changes made)

. destring xpus_m, replace
xpus_m: all characters numeric; replaced as int
(16717 missing values generated)

. rename xpus_m debt_m

. gen debt_y = 12 * debt_m
(16,717 missing values generated)

. gen totaldebt = debtamount
(10,841 missing values generated)

. 
. replace rent_y = 0 if owner == 1 
(15,941 real changes made)

. 
. replace mortgage_y = 0 if tenure == "Owned outright" | tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented" 
(16,573 real changes made)

. 
. replace totaldebt = 0 if us == "0" | us == "No"
(7,962 real changes made)

. 
. gen f_wealth = totalsaving - totaldebt
(6,754 missing values generated)

. gen p_wealth = homevalue 
(7,510 missing values generated)

. 
. gen f_wealthHH = f_wealth / HH
(6,754 missing values generated)

. gen p_wealthHH = p_wealth / HH
(7,510 missing values generated)

. 
. gen incomedis = fihhyr2_m - rent_y - mortgage_y
(11,931 missing values generated)

. gen incomedisHH = incomedis/ HH
(11,931 missing values generated)

. 
. 
. drop if leave == . | female == . | age == . | educ == . | wkstat == . | incomedisHH == . | f_wealth == . | p_wealth == .
(23,791 observations deleted)

. 
. rename subsid id

. sort id year

. 
. bysort id: egen af2 = mean(female)

. drop if af2 == .5 
(4 observations deleted)

. drop af2

. 
. egen z_income_disHH = std(incomedisHH)

. egen z_f_wealth = std(f_wealthHH)

. egen z_p_wealth = std(p_wealthHH)

. 
. 
. 
. 
end of do-file

. 
. gen nochangeECON = 1 if geneconexp1 ==  "Stay the same" | geneconexp1 == "stayed the same" 
(4,755 missing values generated)

. replace nochangeECON = 0 if geneconexp1 == "Get a little better" | geneconexp1 == "Get a little worse" | ///
> geneconexp1 == "Get a lot better" | geneconexp1 == "Get a lot worse" | geneconexp1 == "get a little better" | /// 
> geneconexp1 == "get a little worse" | geneconexp1 == "get a lot worse" | | geneconexp1 == "get a lot better"
(4,490 real changes made)

. 
. 
. gen nochangePERSONAL = 1 if hhfinexp1 ==  "Stay the same" | hhfinexp1 == "stayed the same" 
(3,269 missing values generated)

. replace nochangePERSONAL = 0 if hhfinexp1 == "Get a little better" | hhfinexp1 == "Get a little worse" | ///
> hhfinexp1 == "Get a lot better" | hhfinexp1 == "Get a lot worse" | hhfinexp1 == "get a little better" | /// 
> hhfinexp1 == "get a little worse" | hhfinexp1 == "get a lot worse" | | hhfinexp1 == "get a lot better"
(3,130 real changes made)

. 
. qui reg nochangeECON z_p_wealth z_income_disHH $cfef ,r

. qui margins, at(z_p_wealth = (-1 0 1 2)) post

. regsave  using "$temp/fig5data", replace   ci
file ~/Dropbox/Replication/BJPS/temp/fig5data.dta saved

. 
. qui reg nochangePERSONAL z_p_wealth z_income_disHH  $cfef ,r

. qui margins, at(z_p_wealth = (-1 0 1 2)) post

. regsave  using "$temp/fig5data", append   ci
file ~/Dropbox/Replication/BJPS/temp/fig5data.dta saved

. restore

. 
. 
. ************************************************************************
. *                                                       5. Data Analysis
. ************************************************************************
. 
. do "$code/4-tab2" // Produces Table 2

. /**********************************************
> Table 2: Wealth Effect on Leave Support (BES)
> ***********************************************/
. 
. * Column 1
. 
. qui reg leave z_income_disHH z_f_wealth z_p_wealth , r

. outreg2 using "$output/tab2.doc",  replace  nocons ctitle(" ") dec(3)   
~/Dropbox/Replication/BJPS/figures/tab2.doc
dir : seeout

. 
. * Column 2
. 
. qui reg leave z_income_disHH z_f_wealth z_p_wealth $cfe, r

. regsave  using "$temp/fig2data", replace   ci
file ~/Dropbox/Replication/BJPS/temp/fig2data.dta saved

. outreg2 using "$output/tab2.doc", nocons ctitle(" ") dec(3)    append tex 
~/Dropbox/Replication/BJPS/figures/tab2.tex
~/Dropbox/Replication/BJPS/figures/tab2.doc
dir : seeout

. 
end of do-file

. do "$code/10-fige1" // Produces Figure E1

. /***********************************************
> Figure E1: Leave Support Aggregate vs Individual
> ***********************************************/
. 
. ** indiv
. qui reg leave z_income_dis z_f_wealth z_p_wealth $cfe , r

. qui margins, at (z_p_wealth=(-1(1)2)) post

. marginsplot, xtitle("Individual Property Wealth") ytitle("Pr(Leave)") title("")

  Variables that uniquely identify margins: z_p_wealth

. graph export "$output/fige11.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fige11.pdf written in PDF format)

. 
. ** agg
. 
. gen high = 1 if low == 0
(4,387 missing values generated)

. replace high = 0 if low == 1
(4,387 real changes made)

. 
. qui reg leave high z_income_dis  $cfe , r

. qui margins, at (high=(0 1 )) 

. marginsplot,  xtitle("LSOA Median Home Prices") ytitle("Pr(Leave)") title("")  

  Variables that uniquely identify margins: high

. graph export "$output/fige12.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fige12.pdf written in PDF format)

. 
. 
. 
end of do-file

. do "$code/11-fige2" // Produces Figure E2

. /***********************************************
> Figure E2: BES Main Results by High/Low LSOA Median Home Prices
> ***********************************************/
. 
. qui reg leave z_income_dis z_f_wealth c.z_p_wealth $cfe if low==0,r

. qui margins, atmeans at(z_p_wealth = (-1(1)2)) post

. est store m1_property

. 
. qui reg leave z_income_dis z_f_wealth c.z_p_wealth $cfe if low==1,r

. qui margins, atmeans at(z_p_wealth = (-1(1)2)) post

. est store m2_property

. 
. 
. coefplot (m1_property, label("High LSOA Home Price")) /// 
>  (m2_property , label("Low LSOA Home Price") lpattern(solid)),     legend(off) ///
>  at recast(line) lwidth(*2) ciopts(recast(rline) lpattern(dash))  xtitle("Property Wealth") ytitle("Pr(Leave)") 

. graph export "$output/fige2.pdf", replace
(file ~/Dropbox/Replication/BJPS/figures/fige2.pdf written in PDF format)

. 
end of do-file

. 
. do "$code/5-tabd1" // Produces Table D1

. /**********************************************
> Table D1: Wealth Increases Brexit Support (Survey Experiment)
> ***********************************************/
. 
. preserve

. yougov
(93,192 missing values generated)
(4,122 real changes made)
(414 real changes made, 414 to missing)
(167 real changes made, 167 to missing)
(93,606 missing values generated)
(3,955 real changes made)
(743 real changes made, 743 to missing)
(65,724 observations deleted)
(16,190 missing values generated)
(530 real changes made)
(671 real changes made)
(11,465 real changes made)
(2,833 real changes made)
(691 observations deleted)
(14,471 missing values generated)
(14,471 real changes made)
(30,153 missing values generated)
(350 real changes made)
(510 real changes made)
(2,343 real changes made)
(433 real changes made)
(371 real changes made)
(571 real changes made)
(2,537 real changes made)
(26,950 missing values generated)
(3,912 real changes made)

. 
. * Column 1
. 
. qui reg outcome treat   , r 

. outreg2 using "$output/tabd1.doc",  replace  nocons  ctitle(" ")  dec(3)   
~/Dropbox/Replication/BJPS/figures/tabd1.doc
dir : seeout

. qui margins, at (treat = (0 1)) post

. regsave using "$temp/fig6data", replace
file ~/Dropbox/Replication/BJPS/temp/fig6data.dta saved

. 
. * Column 2
. 
. qui reg outcome treat $cfexp  , r 

. outreg2 using "$output/tabd1.doc",    nocons  ctitle(" ")  dec(3)    append tex
~/Dropbox/Replication/BJPS/figures/tabd1.tex
~/Dropbox/Replication/BJPS/figures/tabd1.doc
dir : seeout

. 
. qui sum outcome if treat==0 & e(sample)==1

. local Mean = r(mean)

. qui reg

. local percent = _b[treat]/`Mean'

. restore

. 
end of do-file

. do "$code/6-tabd2" // Produces Table D2

. /**********************************************
> Table D2: Effect of Wealth Treatment on Risk Aversion
> ***********************************************/
. 
. preserve

. yougov
(93,192 missing values generated)
(4,122 real changes made)
(414 real changes made, 414 to missing)
(167 real changes made, 167 to missing)
(93,606 missing values generated)
(3,955 real changes made)
(743 real changes made, 743 to missing)
(65,724 observations deleted)
(16,190 missing values generated)
(530 real changes made)
(671 real changes made)
(11,465 real changes made)
(2,833 real changes made)
(691 observations deleted)
(14,471 missing values generated)
(14,471 real changes made)
(30,153 missing values generated)
(350 real changes made)
(510 real changes made)
(2,343 real changes made)
(433 real changes made)
(371 real changes made)
(571 real changes made)
(2,537 real changes made)
(26,950 missing values generated)
(3,912 real changes made)

. 
. * Column 1
. 
. qui reg risk risktreat , r

. outreg2 using "$output/tabd2.doc",  replace  nocons  ctitle(" ")  dec(3)   
~/Dropbox/Replication/BJPS/figures/tabd2.doc
dir : seeout

. qui margins, at (risktreat = (0 1)) post

. regsave using "$temp/fig7data", replace
file ~/Dropbox/Replication/BJPS/temp/fig7data.dta saved

. 
. * Column 2
. 
. qui reg risk risktreat $cfexp, r

. outreg2 using "$output/tabd2.doc",    nocons  ctitle(" ")  dec(3)    append tex
~/Dropbox/Replication/BJPS/figures/tabd2.tex
~/Dropbox/Replication/BJPS/figures/tabd2.doc
dir : seeout

. 
. qui sum risk if risktreat==0 & e(sample)==1   // to get control mean

. local Mean2 = r(mean)

. qui reg

. local percent = _b[risktreat]/`Mean2'

. 
. restore

. 
end of do-file

. do "$code/7-figd4" // Produces Figure D4

. /**********************************************
> Figure D4: Survey Experiment Randomization Check
> ***********************************************/
. 
. preserve

. yougov
(93,192 missing values generated)
(4,122 real changes made)
(414 real changes made, 414 to missing)
(167 real changes made, 167 to missing)
(93,606 missing values generated)
(3,955 real changes made)
(743 real changes made, 743 to missing)
(65,724 observations deleted)
(16,190 missing values generated)
(530 real changes made)
(671 real changes made)
(11,465 real changes made)
(2,833 real changes made)
(691 observations deleted)
(14,471 missing values generated)
(14,471 real changes made)
(30,153 missing values generated)
(350 real changes made)
(510 real changes made)
(2,343 real changes made)
(433 real changes made)
(371 real changes made)
(571 real changes made)
(2,537 real changes made)
(26,950 missing values generated)
(3,912 real changes made)

. 
. qui reg treat $cfexp , r

. estimate store randcheck

. coefplot randcheck, drop (_cons) xline(0, lcolor(red) lstyle(solid)) msymbol(circle)  ///
>   legend(off) mfcolor(black) mlcolor (white) msize(medium) ///
>  ciopts(lpatt(solid)lcol(black)) xtitle("Randomization Check") ///
>  coeflabels(1.anyUniW19 ="High Educ Enrol" 2.anyUniW19 ="High Educ Not Finished" 3.anyUniW19 = "High Educ Grad" ///
>   2.wkstat ="Unemployed" 3.wkstat ="Student" 4.wkstat ="Retired" 5.wkstat ="Not in Paid Work"   /// 
>   female = "Female")

. 
.  graph export "$output/figd41.pdf",  replace
(file ~/Dropbox/Replication/BJPS/figures/figd41.pdf written in PDF format)

.  
. qui reg risktreat $cfexp , r

. estimate store randcheckrisk

. coefplot randcheckrisk, drop (_cons) xline(0, lcolor(red) lstyle(solid)) msymbol(circle)  ///
>   legend(off) mfcolor(black) mlcolor (white) msize(medium) ///
>  ciopts(lpatt(solid)lcol(black)) xtitle("Randomization Check") ///
>  coeflabels(1.anyUniW19 ="High Educ Enrol" 2.anyUniW19 ="High Educ Not Finished" 3.anyUniW19 = "High Educ Grad" ///
>   2.wkstat ="Unemployed" 3.wkstat ="Student" 4.wkstat ="Retired" 5.wkstat ="Not in Paid Work"   /// 
>   female = "Female")

. 
.  graph export "$output/figd42.pdf",  replace
(file ~/Dropbox/Replication/BJPS/figures/figd42.pdf written in PDF format)

. 
. restore

. 
end of do-file

. 
. 
. b
(25,998 missing values generated)
(3,992 real changes made)
(3,009 real changes made)
(4,735 real changes made)
(22,006 missing values generated)
(7,744 real changes made)
(14,604 missing values generated)
(14,604 real changes made)
(22,689 missing values generated)
(6,800 real changes made)
(12,676 real changes made)
(19,227 missing values generated)
(901 real changes made)
(1,020 real changes made)
(7,726 real changes made)
(2,384 real changes made)
(1,279 real changes made)
(2,489 real changes made)
fihhyr2_m: all characters numeric; replaced as long
(3768 missing values generated)

. 
. ** Household Size
. 
. 
. qui tab numberchildren  

. 
. replace numberchildren = 5 if numberchildren >=5 &   numberchildren !=. 
(13 real changes made)

. replace otheradults = "6" if otheradults == "More than 6"
(16 real changes made)

. replace otheradults = "." if otheradults == "NA"
(0 real changes made)

. destring otheradults, replace
otheradults: all characters numeric; replaced as byte
(12012 missing values generated)

. 
. gen adults2014 = otheradults2014 + 1
(24,036 missing values generated)

. gen adults2015 = otheradults if year == 2015 
(24,030 missing values generated)

. replace adults2015 = adults2015 + 1
(6,007 real changes made)

. gen adults2016 = nadults if year == 2016
(24,026 missing values generated)

. gen adults2017 =  otheradults if year == 2017
(24,019 missing values generated)

. replace adults2017 = adults2017 + 1
(6,018 real changes made)

. gen adults2018 =  otheradults if year == 2018
(24,037 missing values generated)

. replace adults2018 = adults2018 + 1
(6,000 real changes made)

. 
. gen adults = adults2014  if year == 2014
(24,036 missing values generated)

. replace adults = adults2015 if year == 2015
(6,007 real changes made)

. replace adults = adults2016 if year == 2016
(6,011 real changes made)

. replace adults = adults2017 if year == 2017
(6,018 real changes made)

. replace adults = adults2018 if year == 2018
(6,000 real changes made)

. 
. replace adults = 5 if adults >=5 & adults !=. 
(293 real changes made)

. 
. gen adults_nohead = adults - 1

. 
. gen weight_adult = 0.5 * adults_nohead

. gen weight_kid = 0.3 * numberchildren

. 
. gen HHsize = 1 + weight_adult + weight_kid

. 
. gen incomeHH = fihhyr2_m / HHsize
(3,768 missing values generated)

. 
. 
. *** Mortgage
. 
. replace xpmg_m = "." if xpmg_m == "don't know"
(357 real changes made)

. replace xpmg_m = "." if xpmg_m == "refused"
(406 real changes made)

. replace xpmg_m = "." if xpmg_m == "NA"
(0 real changes made)

. replace xpmg_m = "." if xpmg_m == "Don't know"
(56 real changes made)

. replace xpmg_m = "." if xpmg_m == "Not applicable"
(4,181 real changes made)

. replace xpmg_m = "." if xpmg_m == "not applicable"
(16,348 real changes made)

. replace xpmg_m = "." if xpmg_m == "Refused"
(112 real changes made)

. destring xpmg_m, replace
xpmg_m: all characters numeric; replaced as int
(21460 missing values generated)

. rename xpmg_m mortgage_m

. gen mortgage_y = 12 * mortgage_m 
(21,460 missing values generated)

. 
. 
. *** Rent
. replace mrent = "." if mrent == "Don't know"
(275 real changes made)

. replace mrent = "." if mrent == "NA"
(12,188 real changes made)

. replace mrent = "." if mrent == "Prefer not to state"
(356 real changes made)

. destring mrent, replace
mrent: all characters numeric; replaced as long
(24827 missing values generated)

. gen rent_y = 12 * mrent
(24,827 missing values generated)

. 
. 
. **********************
. * Wealth 
. **********************
. 
. qui tab tenure

. 
. gen owner = 1 if tenure == "Owned mortgage" | tenure == "Owned outright"
(14,096 missing values generated)

. replace owner = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace hsval_m = "." if hsval_m == "don't know"
(338 real changes made)

. replace hsval_m = "." if hsval_m == "refused"
(276 real changes made)

. replace hsval_m = "." if hsval_m == "NA"
(4,610 real changes made)

. replace hsval_m = "." if hsval_m == "Don't know"
(479 real changes made)

. replace hsval_m = "." if hsval_m == "not applicable"
(7,651 real changes made)

. replace hsval_m = "." if hsval_m == "Not applicable"
(1,870 real changes made)

. replace hsval_m = "." if hsval_m == "Refused"
(180 real changes made)

. destring hsval_m, replace
hsval_m: all characters numeric; replaced as long
(15404 missing values generated)

. 
. rename hsval_m homevalue

. replace homevalue = 0 if tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented"
(7,894 real changes made)

. 
. replace saveamount_m = "." if saveamount_m == "don't know"
(1,778 real changes made)

. replace saveamount_m = "." if saveamount_m == "refused"
(2,113 real changes made)

. replace saveamount_m = "." if saveamount_m == "NA"
(25 real changes made)

. destring saveamount, replace
saveamount_m: all characters numeric; replaced as double
(3916 missing values generated)

. 
. gen saveamount_y = 12 * saveamount_m 
(3,916 missing values generated)

. 
. replace nvesttot_m = "." if nvesttot_m == "refused"
(1,190 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "NA"
(44 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "Not applicable"
(1,010 real changes made)

. replace nvesttot_m = "." if nvesttot_m == "not applicable"
(3,344 real changes made)

. 
. destring nvesttot_m, replace 
nvesttot_m: all characters numeric; replaced as long
(5588 missing values generated)

. rename nvesttot_m totalsaving

. 
. replace ustot_m = "." if ustot_m == "don't know"
(862 real changes made)

. replace ustot_m = "." if ustot_m == "refused"
(550 real changes made)

. replace ustot_m = "." if ustot_m == "NA"
(294 real changes made)

. replace ustot_m = "." if ustot_m == "Don't know"
(189 real changes made)

. replace ustot_m = "." if ustot_m == "Not applicable"
(2,934 real changes made)

. replace ustot_m = "." if ustot_m == "not applicable"
(5,883 real changes made)

. replace ustot_m = "." if ustot_m == "Refused"
(129 real changes made)

. destring ustot_m, replace
ustot_m: all characters numeric; replaced as long
(10841 missing values generated)

. rename ustot_m debtamount

. 
. 
. replace xpus_m = "." if xpus_m == "don't know"
(1,062 real changes made)

. replace xpus_m = "." if xpus_m == "refused"
(1,356 real changes made)

. replace xpus_m = "." if xpus_m == "NA"
(2,517 real changes made)

. replace xpus_m = "." if xpus_m == "Don't know"
(207 real changes made)

. replace xpus_m = "." if xpus_m == "Not applicable"
(2,934 real changes made)

. replace xpus_m = "." if xpus_m == "not applicable"
(8,153 real changes made)

. replace xpus_m = "." if xpus_m == "Refused"
(488 real changes made)

. destring xpus_m, replace
xpus_m: all characters numeric; replaced as int
(16717 missing values generated)

. rename xpus_m debt_m

. gen debt_y = 12 * debt_m
(16,717 missing values generated)

. gen totaldebt = debtamount
(10,841 missing values generated)

. 
. replace rent_y = 0 if owner == 1 
(15,941 real changes made)

. 
. replace mortgage_y = 0 if tenure == "Owned outright" | tenure == "Housing association rented" | tenure == "Local authority rented" | tenure == "Private rented" 
(16,573 real changes made)

. 
. replace totaldebt = 0 if us == "0" | us == "No"
(7,962 real changes made)

. 
. gen f_wealth = totalsaving - totaldebt
(6,754 missing values generated)

. gen p_wealth = homevalue 
(7,510 missing values generated)

. 
. gen f_wealthHH = f_wealth / HH
(6,754 missing values generated)

. gen p_wealthHH = p_wealth / HH
(7,510 missing values generated)

. 
. gen incomedis = fihhyr2_m - rent_y - mortgage_y
(11,931 missing values generated)

. gen incomedisHH = incomedis/ HH
(11,931 missing values generated)

. 
. 
. drop if leave == . | female == . | age == . | educ == . | wkstat == . | incomedisHH == . | f_wealth == . | p_wealth == .
(23,791 observations deleted)

. 
. rename subsid id

. sort id year

. 
. bysort id: egen af2 = mean(female)

. drop if af2 == .5 
(4 observations deleted)

. drop af2

. 
. egen z_income_disHH = std(incomedisHH)

. egen z_f_wealth = std(f_wealthHH)

. egen z_p_wealth = std(p_wealthHH)

. 
. 
. 
. 
end of do-file

. do "$code/8-tab3" // Produces Table 3

. /**********************************************
> Table 3: Wealth Effect on Leave Support (BoE)
> ***********************************************/
. 
. 
. * Column 1
. 
. xtset id year
       panel variable:  id (unbalanced)
        time variable:  year, 2016 to 2018, but with gaps
                delta:  1 unit

. qui xtreg leave_bin z_income_disHH  z_f_wealth z_p_wealth   $cfep, fe cl(id)

. outreg2 using "$output/tab3.doc", replace  dec(3)   
~/Dropbox/Replication/BJPS/figures/tab3.doc
dir : seeout

. 
. * Columm 2
. 
. qui xtreg leave_bin z_income_disHH  z_f_wealth z_p_wealth $cfef, fe cl(id)

. regsave  using "$temp/fig4data", replace   ci
file ~/Dropbox/Replication/BJPS/temp/fig4data.dta saved

. outreg2 using "$output/tab3.doc",   dec(3)   append tex
~/Dropbox/Replication/BJPS/figures/tab3.tex
~/Dropbox/Replication/BJPS/figures/tab3.doc
dir : seeout

. 
end of do-file

. do "$code/9-figd5" // Produces Figure D5

. /***********************************************
> Figure D5: Respondents Do Not Believe Post-Brexit Prices are Changing as a function of Property Wealth (BoE Sample)
> ***********************************************/
. 
. gen home_price_change = 1 if hpexp1 == "Decrease by 1%-4.9%" | hpexp1 == "Decrease by 10%-20%" | hpexp1 == "Decrease by 5%-9.9%" | hpexp1 == "Decrease by more than 20%" // decrease
(4,868 missing values generated)

. replace home_price_change = 1 if hpexp1 == "Increase by 1%-4.9%" | hpexp1 == "Increase bt 10%-20%" | hpexp1 == "Increase by 5%-9.9%" | hpexp1 == "Increase by more than 20%" // increase
(2,292 real changes made)

. replace home_price_change = 0 if hpexp1 == "No change"
(1,469 real changes made)

. 
. qui reg home_price_change z_p_wealth z_income_disHH $cfef, cl (id)

. qui margins, at(z_p_wealth = (-1 0 1 2 3 4 5 6 )) post

. marginsplot, xtitle("Property Wealth")

  Variables that uniquely identify margins: z_p_wealth

. graph export "$output/figd5.pdf",  replace
(file ~/Dropbox/Replication/BJPS/figures/figd5.pdf written in PDF format)

. 
. 
end of do-file

. 
. 
. 
. 
. log close
      name:  <unnamed>
       log:  /Users/raluca/Dropbox/Replication/BJPS/analysis_log.log
  log type:  text
 closed on:  11 Dec 2023, 12:41:09
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
